From e4108b830569293a1da6fdee993abdb2fd3a3584 Mon Sep 17 00:00:00 2001 From: Jose Henrique Date: Sat, 28 Dec 2024 21:35:51 -0300 Subject: [PATCH] adding colors to docker updater --- docker-updater.sh | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/docker-updater.sh b/docker-updater.sh index ecfda3e..f933a08 100644 --- a/docker-updater.sh +++ b/docker-updater.sh @@ -1,5 +1,10 @@ #!/bin/bash +NC='\033[0m' +LIGHT_BLUE='\033[1;34m' +LIGHT_GREEN='\033[1;32m' +LIGHT_GREY='\033[0;37m' + ### AUTO-UPDATER ### export FILE_NAME="docker-updater.sh" SERVER_AU="https://git.ivanch.me/ivanch/server-scripts/raw/branch/main/auto-updater.sh" @@ -19,7 +24,7 @@ DOCKER_FOLDER=/root/docker if [ -d "$DOCKER_FOLDER" ]; then cd $DOCKER_FOLDER else - echo "Error: $DOCKER_FOLDER not found." >&2 + echo -e "${LIGHT_GREY}[i] Docker folder not found.${NC}" exit 1 fi @@ -31,28 +36,28 @@ for folder in */; do DOCKER_RUNNING=$(docker-compose ps -q) if [ -n "$DOCKER_RUNNING" ]; then - echo "[$folder] Stopping Docker containers" + echo -e "${LIGHT_BLUE}[$folder] Stopping Docker containers" docker-compose down > /dev/null else - echo "[$folder] No Docker containers running" + echo -e "${LIGHT_BLUE}[$folder] No Docker containers running" fi - echo "[$folder] Updating images" + echo -e "${LIGHT_BLUE}[$folder] Updating images" docker-compose pull > /dev/null if [ -n "$DOCKER_RUNNING" ]; then - echo "[$folder] Starting Docker containers" + echo -e "${LIGHT_BLUE}[$folder] Starting Docker containers" docker-compose up -d > /dev/null fi - echo "[$folder] Updated!" + echo -e "${LIGHT_GREEN}[$folder] Updated!" cd .. done # Run Docker image prune -echo "Running Docker image prune..." +echo -e "${LIGHT_BLUE}Running Docker image prune..." docker image prune -af -echo "Done!" \ No newline at end of file +echo -e "${LIGHT_GREEN} All done!" \ No newline at end of file