trabajo-afectivo/contrib/backup/zammad_restore.sh
Martin Gruner 89f44eec6d Maintenance: Improve backup and restore handling.
* Made parsing of database configuration more robust.
* Improved PostgreSQL handling for better password handling and to support remote databases.
* Other small fixes.
* Closes #3352, closes #3561, closes: #3621.

Special thanks to Alexander (7adietri) and Michal Čihař (nijel) for their PRs on this.
2021-06-21 10:11:10 +00:00

43 lines
692 B
Bash
Executable file

#!/usr/bin/env bash
#
# zammad restore script
#
# shellcheck disable=SC2046
BACKUP_SCRIPT_PATH="$(dirname $(realpath $0))"
if [ -f "${BACKUP_SCRIPT_PATH}/config" ]; then
# import config
. ${BACKUP_SCRIPT_PATH}/config
else
echo -e "\n The 'config' file is missing!"
echo -e " Please copy ${BACKUP_SCRIPT_PATH}/config.dist to ${BACKUP_SCRIPT_PATH}/config before running $0!\n"
exit 1
fi
# import functions
. ${BACKUP_SCRIPT_PATH}/functions
# exec restore
start_restore_message
get_zammad_dir
restore_warning "${1}"
check_database_config_exists
get_restore_dates
choose_restore_date "${1}"
detect_initcmd
stop_zammad
restore_zammad
start_zammad
finished_restore_message