biiig wrench

This commit is contained in:
Your Name
2025-05-03 22:58:39 +12:00
parent 107034cf7b
commit 340170b248
51 changed files with 347 additions and 395 deletions

View File

@ -1,40 +1,13 @@
#!/bin/bash
source "${AGENT_PATH}/_common.sh"
# BACKUP SCRIPT
# The backup script is OPTIONAL.
# It is used to backup the service on the server.
# Simple Object Storage Backup Script
# Creates a backup tarball of the volume contents.
source "$(dirname "$0")/_common.sh"
check_required_env_vars "CONTAINER_NAME" "VOLUME_NAME"
_check_required_env_vars "CONTAINER_NAME" "VOLUME_NAME"
# HOT backup is fine for simple-object-storage
autobackup "volume=${VOLUME_NAME}" $1 $2 || _die "Failed to create backup"
# Get backup file path from first argument
BACKUP_FILE="$1"
if [ -z "$BACKUP_FILE" ]; then
die "Backup file path not provided"
fi
TEMP_DIR=$2
if [ -z "$TEMP_DIR" ]; then
die "Temporary directory not provided"
fi
# Check if backup file already exists
if [ -f "$BACKUP_FILE" ]; then
die "Backup file $BACKUP_FILE already exists"
fi
# Create backup of data folder
echo "Creating backup of $VOLUME_NAME..."
docker run --rm -v ${VOLUME_NAME}:/data -v ${TEMP_DIR}:/tempdir alpine sh -c "\
tar zcvf /tempdir/backup.tar.gz -C /data ."
cp ${TEMP_DIR}/backup.tar.gz $BACKUP_FILE
# dropshell cleans up temp dir after script finishes
echo "Backup created successfully: $BACKUP_FILE"
echo "Backup complete: ${BACKUP_FILE}"