#!/bin/bash # RESTORE SCRIPT # The restore script is OPTIONAL. # It is used to restore the service on the server from a backup file. # It is called with one argument: the path to the backup file. source "$(dirname "$0")/_common.sh" check_required_env_vars "CONTAINER_NAME" "LOCAL_DATA_FOLDER" # Get backup file path from first argument BACKUP_FILE="$1" 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 does not exist" fi # # Stop container before backup # _stop_container "$CONTAINER_NAME" # Create backup of data folder # echo "Creating backup of $LOCAL_DATA_FOLDER..." # if ! tar zcvf "$BACKUP_FILE" -C "$LOCAL_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" echo "Backup restored successfully!"