25 lines
601 B
Bash
Executable File
25 lines
601 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# Source common functions
|
|
source "$(dirname "$0")/_common.sh"
|
|
|
|
# Load environment variables
|
|
load_env "$1" || die "Failed to load environment variables"
|
|
|
|
# set the backup file name to be the current date and time
|
|
BACKUP_FILE="$BACKUP_FOLDER/backup-squashkiwi-$(date +%Y-%m-%d_%H-%M-%S).tar.gz"
|
|
|
|
if [ -f "$BACKUP_FILE" ]; then
|
|
echo "Backup file $BACKUP_FILE already exists"
|
|
exit 1
|
|
fi
|
|
|
|
stop_container
|
|
|
|
# create the backup file, using relative paths.
|
|
tar zcvf "$BACKUP_FILE" -C "$DATA_FOLDER" . || die "Failed to create backup"
|
|
|
|
start_container
|
|
|
|
echo "Backup created in $BACKUP_FILE"
|