From 7fa5ac7c1e4eabe7c5b6eb871a825ce53f2553b5 Mon Sep 17 00:00:00 2001 From: David Gomes Date: Sun, 17 Sep 2023 16:10:22 +0100 Subject: [PATCH] chore: minor improvements on scripts --- server/scripts/auto-update.sh | 3 ++- server/scripts/launch-all.sh | 16 +++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/server/scripts/auto-update.sh b/server/scripts/auto-update.sh index 072e12e..dc3fff5 100755 --- a/server/scripts/auto-update.sh +++ b/server/scripts/auto-update.sh @@ -2,6 +2,7 @@ # Colors +START=$(tput setaf 4) SUCCESS=$(tput setaf 2) WARNING=$(tput setaf 3) INFO=$(tput setaf 6) @@ -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 diff --git a/server/scripts/launch-all.sh b/server/scripts/launch-all.sh index f7cf862..157b654 100755 --- a/server/scripts/launch-all.sh +++ b/server/scripts/launch-all.sh @@ -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) @@ -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