23 lines
715 B
Bash
23 lines
715 B
Bash
#!/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 "DATA_VOLUME" "CONFIG_VOLUME" "CONFIG_PATH"
|
|
|
|
# uninstall container before restore
|
|
bash ./uninstall.sh || die "Failed to uninstall service before restore"
|
|
|
|
# restore data from backup file
|
|
if ! autorestore volume=$DATA_VOLUME volume=$CONFIG_VOLUME "$1" "$2"; then
|
|
die "Failed to restore data from backup file"
|
|
fi
|
|
|
|
# reinstall service
|
|
bash ./install.sh || die "Failed to reinstall service after restore"
|
|
|
|
echo "Restore complete! Service is running again."
|