trabajo-afectivo/contrib/backup/zammad_backup.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
768 B
Bash
Executable file

#!/usr/bin/env bash
#
# zammad backup script
#
# shellcheck disable=SC2046
BACKUP_SCRIPT_PATH="$(dirname $(realpath $0))"
if [ -f "${BACKUP_SCRIPT_PATH}/config" ]; then
# Ensure we're inside of our Backup-Script folder (see issue 2508)
# shellcheck disable=SC2164
cd "${BACKUP_SCRIPT_PATH}"
# 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 backup
start_backup_message
get_zammad_dir
check_database_config_exists
delete_old_backups
get_backup_date
backup_dir_create
backup_files
backup_db
finished_backup_message