From f143d0782df9836e9c850c86176e581e3578e454 Mon Sep 17 00:00:00 2001 From: vince Date: Tue, 19 Mar 2024 18:31:12 -0600 Subject: [PATCH] Updated UPME Changed UPME to recursively loop through all folders inside of /compose and added pruning of docker to the end of the script. --- docker/upme | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 docker/upme diff --git a/docker/upme b/docker/upme new file mode 100644 index 0000000..e0a00d9 --- /dev/null +++ b/docker/upme @@ -0,0 +1,31 @@ +#!/bin/bash + +# Define the base directory to iterate through +base_dir="/compose" + +# Function to process each directory +process_directory() { + for dir in "$1"/*; do + if [ -d "$dir" ]; then + echo "Processing $dir" + # Change to the directory + cd "$dir" || exit + # Pull the docker compose, suppressing stdout and stderr + docker compose pull + docker compose up -d --remove-orphans + # Go back to the previous directory + cd - > /dev/null 2>&1 + # Recursively process subdirectories + process_directory "$dir" + fi + done +} + +# Start processing from the base directory +process_directory "$base_dir" + +# After processing all directories, run docker system prune +echo "Running docker system prune --volumes -af" +docker system prune --volumes -af + +echo "Process completed." \ No newline at end of file