Zabbix backup set port to 5432 default to override internal set ports

This commit is contained in:
Clemens Schwaighofer
2025-08-20 22:11:38 +09:00
parent 8407defe4f
commit de9d5d3588
2 changed files with 6 additions and 1 deletions

View File

@@ -15,3 +15,5 @@ ZABBIX_DATABASE="";
ZABBIX_CONFIG="";
# unknown tables, default ignore, is set to true, will force backup them
ZABBIX_UNKNOWN_TABLES="";
# db port for zabbix, defaults to 5432
ZABBIX_DB_PORT="";

View File

@@ -37,6 +37,9 @@ fi;
if [ "${ZABBIX_DATABASE}" = "psql" ]; then
OPT_ZABBIX_DUMP="-C";
fi;
if [ -z "${ZABBIX_DB_PORT}" ]; then
ZABBIX_DB_PORT="5432";
fi;
if [ "${ZABBIX_DATABASE}" != "psql" ] && [ "${ZABBIX_DATABASE}" != "mysql" ]; then
echo "[! $(date +'%F %T')] Zabbix dump must have database set to either psql or mysql";
. "${DIR}/borg.backup.functions.close.sh" 1;
@@ -76,7 +79,7 @@ if [ ${DEBUG} -eq 1 ] || [ ${DRYRUN} -eq 1 ]; then
fi;
fi;
if [ ${DRYRUN} -eq 0 ]; then
${ZABBIX_DUMP_BIN} -t ${ZABBIX_DATABASE} ${OPT_ZABBIX_UNKNOWN_TABLES} ${OPT_ZABBIX_DUMP} ${OPT_ZABBIX_CONFIG} -o - | ${BORG_CALL};
${ZABBIX_DUMP_BIN} -P ${ZABBIX_DB_PORT} -t ${ZABBIX_DATABASE} ${OPT_ZABBIX_UNKNOWN_TABLES} ${OPT_ZABBIX_DUMP} ${OPT_ZABBIX_CONFIG} -o - | ${BORG_CALL};
fi;
if [ -z "${ONE_TIME_TAG}" ]; then
printf "${PRINTF_SUB_BLOCK}" "PRUNE" "$(date +'%F %T')" "${MODULE}";