Skip to content

Commit

Permalink
chore: minor improvements on scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
David Gomes authored and David Gomes committed Sep 17, 2023
1 parent f4786c5 commit 7fa5ac7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
3 changes: 2 additions & 1 deletion server/scripts/auto-update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

# Colors

START=$(tput setaf 4)
SUCCESS=$(tput setaf 2)
WARNING=$(tput setaf 3)
INFO=$(tput setaf 6)
Expand All @@ -14,7 +15,7 @@ RUSTY_HOME_DIR="$HOME/RustyController"
BINARY_PATH="$RUSTY_HOME_DIR/server/target/release/rusty_controller"
HASH_FILE="$RUSTY_HOME_DIR/current.sha256"

echo "$INFO* Running at $(date)$RESET"
echo "$START* Running at $(date)$RESET"

cd "$HOME" || exit 1

Expand Down
16 changes: 11 additions & 5 deletions server/scripts/launch-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@

# Colors

START=$(tput setaf 4)
INFO=$(tput setaf 6)
WARNING=$(tput setaf 3)
SUCCESS=$(tput setaf 2)
RESET=$(tput sgr0)

printf "$START* Running at $(date)$RESET\n"

# Start node_exporter

RUSTY_PATH=$(pwd)
Expand All @@ -13,27 +18,28 @@ NODE_EXPORTER_PATH=${NODE_EXPORTER_PATH:-../node_exporter}
if [ -f "$NODE_EXPORTER_PATH"/node_exporter ]; then
(cd "$NODE_EXPORTER_PATH" && "$RUSTY_PATH"/server/scripts/run-node-exporter.sh)
else
echo "Warning: node_exporter wasn't found in $(pwd)/$NODE_EXPORTER_PATH"
echo "${WARNING}Warning: node_exporter wasn't found in $(pwd)/$NODE_EXPORTER_PATH$RESET"
fi

# Start Grafana stack

printf "Launching Grafana stack...\n\n"
printf "${INFO}* Launching Grafana stack...$RESET\n\n"

(cd server/docker && docker compose -f grafana.yaml up --wait -d) >> /var/log/rusty-controller/run-grafana-stack.log 2>&1

# Update and launch server

printf "Updating and launching server...\n\n"
printf "${INFO}* Updating and launching server...$RESET\n\n"

(cp server/scripts/auto-update.sh /tmp/rusty-auto-update.sh && bash /tmp/rusty-auto-update.sh) >> /var/log/rusty-controller/auto-update.log 2>&1

# Update and launch non-adhoc plugins

printf "Updating and launching plugins...\n\n"
printf "${INFO}* Updating and launching plugins...$RESET\n\n"

PLUGINS_PATH=${PLUGINS_PATH:-../RustyController-plugins}

mkdir -p /var/log/rusty-controller/plugins/ && (cd "$PLUGINS_PATH" && git pull && bash run-all.sh) >> /var/log/rusty-controller/plugins/run-all.log 2>&1

echo -e "${SUCCESS}Finished!$RESET"
echo -e "${SUCCESS}* Finished!$RESET"
echo

0 comments on commit 7fa5ac7

Please sign in to comment.