borg2-backup.sh: alert if Type of databases has a wrong setting.

This commit is contained in:
Christoph 2024-12-08 13:31:20 +01:00
parent 07cfe8a402
commit a5744f9eae

View File

@ -311,11 +311,14 @@ BORG_LOG_FILE="${BORG_LOG_DIR}/borg-backup.log"
[[ -z "${KEEP_YEARLY}" ]] && KEEP_YEARLY=${DEFAULT_KEEP_YEARLY} [[ -z "${KEEP_YEARLY}" ]] && KEEP_YEARLY=${DEFAULT_KEEP_YEARLY}
[[ -z "${DB_TYPE}" ]] && DB_TYPE="${DEFAULT_DB_TYPE}" if [[ -z "${DB_TYPE}" ]] ; then
if [[ "${DB_TYPE,,}" = "mysql" ]] ; then DB_TYPE="${DEFAULT_DB_TYPE}"
elif [[ "${DB_TYPE,,}" = "mysql" ]] ; then
[[ -z "${MYSQL_CREDENTIALS}" ]] && MYSQL_CREDENTIALS="${DEFAULT_MYSQL_CREDENTIALS}" [[ -z "${MYSQL_CREDENTIALS}" ]] && MYSQL_CREDENTIALS="${DEFAULT_MYSQL_CREDENTIALS}"
elif [[ "${DB_TYPE,,}" = "psql" ]] || [[ "${DB_TYPE,,}" = "postgresql" ]] || [[ "${DB_TYPE,,}" = "postgres" ]] ; then elif [[ "${DB_TYPE,,}" = "psql" ]] || [[ "${DB_TYPE,,}" = "postgresql" ]] || [[ "${DB_TYPE,,}" = "postgres" ]] ; then
[[ -z "${PSQL_SYSTEM_USER}" ]] && PSQL_SYSTEM_USER="${DEFAULT_PSQL_SYSTEM_USER}" [[ -z "${PSQL_SYSTEM_USER}" ]] && PSQL_SYSTEM_USER="${DEFAULT_PSQL_SYSTEM_USER}"
else
fatal "Unknown DB_TYPE '${DB_TYPE}'."
fi fi