adding colors to docker updater
All checks were successful
Check scripts syntax / check-scripts-syntax (push) Successful in 3s
All checks were successful
Check scripts syntax / check-scripts-syntax (push) Successful in 3s
This commit is contained in:
parent
c038e372d9
commit
e4108b8305
@ -1,5 +1,10 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
NC='\033[0m'
|
||||||
|
LIGHT_BLUE='\033[1;34m'
|
||||||
|
LIGHT_GREEN='\033[1;32m'
|
||||||
|
LIGHT_GREY='\033[0;37m'
|
||||||
|
|
||||||
### AUTO-UPDATER ###
|
### AUTO-UPDATER ###
|
||||||
export FILE_NAME="docker-updater.sh"
|
export FILE_NAME="docker-updater.sh"
|
||||||
SERVER_AU="https://git.ivanch.me/ivanch/server-scripts/raw/branch/main/auto-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
|
if [ -d "$DOCKER_FOLDER" ]; then
|
||||||
cd $DOCKER_FOLDER
|
cd $DOCKER_FOLDER
|
||||||
else
|
else
|
||||||
echo "Error: $DOCKER_FOLDER not found." >&2
|
echo -e "${LIGHT_GREY}[i] Docker folder not found.${NC}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -31,28 +36,28 @@ for folder in */; do
|
|||||||
DOCKER_RUNNING=$(docker-compose ps -q)
|
DOCKER_RUNNING=$(docker-compose ps -q)
|
||||||
|
|
||||||
if [ -n "$DOCKER_RUNNING" ]; then
|
if [ -n "$DOCKER_RUNNING" ]; then
|
||||||
echo "[$folder] Stopping Docker containers"
|
echo -e "${LIGHT_BLUE}[$folder] Stopping Docker containers"
|
||||||
docker-compose down > /dev/null
|
docker-compose down > /dev/null
|
||||||
else
|
else
|
||||||
echo "[$folder] No Docker containers running"
|
echo -e "${LIGHT_BLUE}[$folder] No Docker containers running"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "[$folder] Updating images"
|
echo -e "${LIGHT_BLUE}[$folder] Updating images"
|
||||||
docker-compose pull > /dev/null
|
docker-compose pull > /dev/null
|
||||||
|
|
||||||
if [ -n "$DOCKER_RUNNING" ]; then
|
if [ -n "$DOCKER_RUNNING" ]; then
|
||||||
echo "[$folder] Starting Docker containers"
|
echo -e "${LIGHT_BLUE}[$folder] Starting Docker containers"
|
||||||
docker-compose up -d > /dev/null
|
docker-compose up -d > /dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "[$folder] Updated!"
|
echo -e "${LIGHT_GREEN}[$folder] Updated!"
|
||||||
|
|
||||||
cd ..
|
cd ..
|
||||||
done
|
done
|
||||||
|
|
||||||
# Run Docker image prune
|
# Run Docker image prune
|
||||||
|
|
||||||
echo "Running Docker image prune..."
|
echo -e "${LIGHT_BLUE}Running Docker image prune..."
|
||||||
docker image prune -af
|
docker image prune -af
|
||||||
|
|
||||||
echo "Done!"
|
echo -e "${LIGHT_GREEN} All done!"
|
Loading…
x
Reference in New Issue
Block a user