From d4a47cd3dc06a23c97b73415b47da0f82c0ee2ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bauer?= Date: Sun, 12 Feb 2017 10:52:35 +0100 Subject: [PATCH] move check for database.yml to functions file --- contrib/backup/functions | 8 ++++++++ contrib/backup/zammad_backup.sh | 9 ++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/contrib/backup/functions b/contrib/backup/functions index aca469247..e6f6b6b77 100644 --- a/contrib/backup/functions +++ b/contrib/backup/functions @@ -48,3 +48,11 @@ function backup_db () { fi } +function check_database_config_exists () { + if [ -f ${ZAMMAD_DIR}/${DATABASE_CONFIG} ]; then + get_db_credentials + else + echo "${ZAMMAD_DIR}/${DATABASE_CONFIG} is missing. is zammad configured yet?" + exit 1 + fi +} diff --git a/contrib/backup/zammad_backup.sh b/contrib/backup/zammad_backup.sh index e0047a4a6..ac1c9ce0d 100755 --- a/contrib/backup/zammad_backup.sh +++ b/contrib/backup/zammad_backup.sh @@ -11,15 +11,10 @@ PATH=/sbin:/bin:/usr/sbin:/usr/bin: # import functions . functions +# exec backup delete_old_backups -# check if database.yml exists -if [ -f ${ZAMMAD_DIR}/${DATABASE_CONFIG} ]; then - get_db_credentials -else - echo "${ZAMMAD_DIR}/${DATABASE_CONFIG} is missing. is zammad configured yet?" - exit 1 -fi +check_database_config_exists get_backup_date