#!/bin/bash ### AUTO-UPDATER ### FILE_NAME="docker-updater.sh" SERVER_AU="https://git.ivanch.me/ivanch/server-scripts/raw/branch/main/auto-updater.sh" # Run auto-updater script curl -sSL $SERVER_AU | bash #################### # Navigate to docker folder DOCKER_FOLDER=/root/docker if [ -d "$DOCKER_FOLDER" ]; then cd $DOCKER_FOLDER else echo "Error: $DOCKER_FOLDER not found." >&2 exit 1 fi # Navigate on each folder and run docker-compose stop, pull and up -d for folder in */; do cd $folder DOCKER_RUNNING=$(docker-compose ps -q) if [ -n "$DOCKER_RUNNING" ]; then echo "[$folder] Stopping Docker containers" docker-compose down > /dev/null else echo "[$folder] No Docker containers running" fi echo "[$folder] Updating images" docker-compose pull > /dev/null if [ -n "$DOCKER_RUNNING" ]; then echo "[$folder] Starting Docker containers" docker-compose up -d > /dev/null fi echo "[$folder] Updated!" cd .. done # Run Docker image prune echo "Running Docker image prune..." docker image prune -af echo "Done!"