mirror of
https://github.com/kevinveenbirkenbach/docker-volume-backup-cleanup.git
synced 2024-11-21 21:31:02 +01:00
Compare commits
No commits in common. "6794061edd5dced40c91132b8a9ee70895f7d000" and "7b00a6584b6d6e77c54e0f3365a898f6338d36b2" have entirely different histories.
6794061edd
...
7b00a6584b
@ -1,36 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Define trigger directory argument as TRIGGER_DIR
|
||||
TRIGGER_DIR="$2"
|
||||
|
||||
# Get the absolute path of the directory where the current script is located
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
||||
|
||||
# Define the path to the original cleanup script using the script directory path
|
||||
CLEANUP_SCRIPT="$SCRIPT_DIR/cleanup_script.sh"
|
||||
|
||||
# Path to the main directory
|
||||
MAIN_DIRECTORY="/Backups"
|
||||
|
||||
# Check if the cleanup script exists
|
||||
if [ ! -f "$CLEANUP_SCRIPT" ]; then
|
||||
echo "Error: The script $CLEANUP_SCRIPT does not exist."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Iterate through each subdirectory in the main directory
|
||||
for BACKUP_FOLDER_PATH in "$MAIN_DIRECTORY"/*; do
|
||||
|
||||
# Extract the base name (folder name) from the path
|
||||
BACKUP_FOLDER=$(basename "$BACKUP_FOLDER_PATH")
|
||||
|
||||
# Check if the 'backup-docker-to-local' directory exists
|
||||
if [ -d "$BACKUP_FOLDER_PATH/backup-docker-to-local" ]; then
|
||||
echo "Running cleanup script for folder: $BACKUP_FOLDER"
|
||||
|
||||
# Call the cleanup script
|
||||
"$CLEANUP_SCRIPT" "$BACKUP_FOLDER" "$TRIGGER_DIR"
|
||||
else
|
||||
echo "Directory $BACKUP_FOLDER_PATH/backup-docker-to-local not found."
|
||||
fi
|
||||
done
|
Loading…
Reference in New Issue
Block a user