From e2dec9b0464718e68ce265d3676883c40869c620 Mon Sep 17 00:00:00 2001 From: jayki Date: Wed, 22 Nov 2017 16:33:50 +0100 Subject: [PATCH] Update functions This is needed for automated restore via Script to the latest Backup file. So the files latest* always point to the newest Backup. --- contrib/backup/functions | 3 +++ 1 file changed, 3 insertions(+) diff --git a/contrib/backup/functions b/contrib/backup/functions index bbb2d4019..b92ec39d4 100644 --- a/contrib/backup/functions +++ b/contrib/backup/functions @@ -41,16 +41,19 @@ function backup_dir_create () { function backup_files () { echo "creating file backup..." tar -czf ${BACKUP_DIR}/${TIMESTAMP}_zammad_files.tar.gz ${ZAMMAD_DIR} + ln -sfn ${BACKUP_DIR}/${TIMESTAMP}_zammad_files.tar.gz ${BACKUP_DIR}/latest_zammad_files.tar.gz } function backup_db () { if [ "${DB_ADAPTER}" == "mysql2" ]; then echo "creating mysql backup..." mysqldump --opt --single-transaction -u${DB_USER} -p${DB_PASS} ${DB_NAME} | gzip > ${BACKUP_DIR}/${TIMESTAMP}_zammad_db.mysql.gz + ln -sfn ${BACKUP_DIR}/${TIMESTAMP}_zammad_db.mysql.gz ${BACKUP_DIR}/latest_zammad_db.mysql.gz elif [ "${DB_ADAPTER}" == "postgresql" ]; then echo "creating postgresql backup..." su -c "pg_dump -c ${DB_NAME} | gzip > /tmp/${TIMESTAMP}_zammad_db.psql.gz" postgres mv /tmp/${TIMESTAMP}_zammad_db.psql.gz ${BACKUP_DIR} + ln -sfn ${BACKUP_DIR}/${TIMESTAMP}_zammad_db.psql.gz ${BACKUP_DIR}/latest_zammad_db.psql.gz else echo "DB ADAPTER not found. if its sqlite backup is already saved in the filebackup" fi