move check for database.yml to functions file

This commit is contained in:
André Bauer 2017-02-12 10:52:35 +01:00
parent 3fe07dd28d
commit d4a47cd3dc
2 changed files with 10 additions and 7 deletions

View file

@ -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
}

View file

@ -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