This commit is contained in:
Your Name
2025-04-21 15:06:39 +12:00
parent a65fbe0bc5
commit b495554424
3 changed files with 241 additions and 233 deletions

View File

@ -1,34 +0,0 @@
#!/bin/bash
# Source common functions
source "$(dirname "$0")/_dockerhelper.sh"
source "$(dirname "$0")/_common.sh"
# Load environment variables
load_env "$1" || die "Failed to load environment variables"
# Get backup file path from second argument
BACKUP_FILE="$2"
if [ -z "$BACKUP_FILE" ]; then
die "Backup file path not provided"
fi
# Check if backup file already exists
if [ -f "$BACKUP_FILE" ]; then
die "Backup file $BACKUP_FILE already exists"
fi
# Stop container before backup
_stop_container "$CONTAINER_NAME"
# Create backup of data folder
echo "Creating backup of $DATA_FOLDER..."
if ! tar zcvf "$BACKUP_FILE" -C "$DATA_FOLDER" .; then
_start_container "$CONTAINER_NAME"
die "Failed to create backup"
fi
# Start container after backup
_start_container "$CONTAINER_NAME"
echo "Backup created successfully: $BACKUP_FILE"