2018-02-01 06:09:32 +00:00
|
|
|
#!/usr/bin/env bash
|
2016-12-10 13:48:33 +00:00
|
|
|
#
|
|
|
|
# zammad backup script
|
|
|
|
#
|
|
|
|
|
|
|
|
PATH=/sbin:/bin:/usr/sbin:/usr/bin:
|
2017-05-07 10:20:59 +00:00
|
|
|
BACKUP_SCRIPT_PATH="$(dirname $(realpath $0))"
|
2016-12-10 13:48:33 +00:00
|
|
|
|
2017-05-07 10:20:59 +00:00
|
|
|
if [ -f "${BACKUP_SCRIPT_PATH}/config" ]; then
|
2019-08-07 10:37:45 +00:00
|
|
|
# Ensure we're inside of our Backup-Script folder (see issue 2508)
|
|
|
|
cd "${BACKUP_SCRIPT_PATH}"
|
|
|
|
|
2017-05-07 10:20:59 +00:00
|
|
|
# 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
|
2016-12-10 13:48:33 +00:00
|
|
|
|
|
|
|
# import functions
|
2017-05-07 10:20:59 +00:00
|
|
|
. ${BACKUP_SCRIPT_PATH}/functions
|
2016-12-10 13:48:33 +00:00
|
|
|
|
2017-02-12 09:52:35 +00:00
|
|
|
# exec backup
|
2017-05-07 10:20:59 +00:00
|
|
|
start_backup_message
|
|
|
|
|
|
|
|
get_zammad_dir
|
|
|
|
|
2017-02-12 09:52:35 +00:00
|
|
|
check_database_config_exists
|
2016-12-10 13:48:33 +00:00
|
|
|
|
2017-02-12 11:52:10 +00:00
|
|
|
delete_old_backups
|
|
|
|
|
2016-12-10 13:48:33 +00:00
|
|
|
get_backup_date
|
|
|
|
|
|
|
|
backup_dir_create
|
|
|
|
|
|
|
|
backup_files
|
|
|
|
|
|
|
|
backup_db
|
2017-05-07 10:20:59 +00:00
|
|
|
|
|
|
|
finished_backup_message
|