Fix zabbix dump var name, remove repository replace

in all BORG_* calls remove the REPOSITORY replace as the repository is
set beforehand for the module

Fix the ZABBIX_DUMP_BIN name in settings and check
This commit is contained in:
Clemens Schwaighofer
2021-12-15 12:50:26 +09:00
parent 49fb930c43
commit 252319848c
3 changed files with 9 additions and 10 deletions

View File

@@ -47,12 +47,11 @@ FILENAME="gitea.backup.zip";
BACKUP_SET_NAME="gitea-${BACKUP_SET}";
BACKUP_SET_PREFIX="gitea-";
# borg call, replace ##...## parts
# _BORG_CALL="borg create ${OPT_REMOTE} -v ${OPT_LIST} ${OPT_PROGRESS} ${OPT_COMPRESSION} -s --stdin-name ##FILENAME## ${REPOSITORY}::##BACKUP_SET## -";
# _BORG_PRUNE="borg prune ${OPT_REMOTE} -v -s --list ${PRUNE_DEBUG} -P ##BACKUP_SET_PREFIX## ${KEEP_OPTIONS[*]} ${REPOSITORY}";
# borg call
BORG_CALL=$(echo "${_BORG_CALL}" | sed -e "s/##FILENAME##/${FILENAME}/" | sed -e "s|##REPOSITORY##|${REPOSITORY}|" | sed -e "s/##BACKUP_SET##/${BACKUP_SET}/");
BORG_PRUNE=$(echo "${_BORG_PRUNE}" | sed -e "s|##REPOSITORY##|${REPOSITORY}|" | sed -e "s/##BACKUP_SET_PREFIX##/${BACKUP_SET_PREFIX}/");
# BORG_CALL=$(echo "${_BORG_CALL}" | sed -e "s/##FILENAME##/${FILENAME}/" | sed -e "s|##REPOSITORY##|${REPOSITORY}|" | sed -e "s/##BACKUP_SET##/${BACKUP_SET}/");
BORG_CALL=$(echo "${_BORG_CALL}" | sed -e "s/##FILENAME##/${FILENAME}/" | sed -e "s/##BACKUP_SET##/${BACKUP_SET}/");
# BORG_PRUNE=$(echo "${_BORG_PRUNE}" | sed -e "s|##REPOSITORY##|${REPOSITORY}|" | sed -e "s/##BACKUP_SET_PREFIX##/${BACKUP_SET_PREFIX}/");
BORG_PRUNE=$(echo "${_BORG_PRUNE}" | sed -e "s/##BACKUP_SET_PREFIX##/${BACKUP_SET_PREFIX}/");
echo "--- [git data and database: $(date +'%F %T')] --[${MODULE}]------------------------------------>";
if [ ${DEBUG} -eq 1 ] || [ ${DRYRUN} -eq 1 ]; then
echo "sudo -u ${GIT_USER} ${GITEA_BIN} dump -c ${GITEA_CONFIG} -w ${GITEA_TMP} -L -f - | ${BORG_CALL}";

View File

@@ -8,7 +8,7 @@
# location for the zabbix dump script
# Source: https://github.com/npotorino/zabbix-backup
# if not set use /usr/local/bin
ZABBIX_DUMP="";
ZABBIX_DUMP_BIN="";
# either psql or mysql, must be set
ZABBIX_DATABASE="";
# config location (default /etc/zabbiz/zabbix_server.conf)

View File

@@ -36,8 +36,8 @@ if [ "${ZABBIX_DATABASE}" != "psql" ] && [ "${ZABBIX_DATABASE}" != "mysql" ]; th
echo "[! $(date +'%F %T')] Zabbix dump must have database set to either psql or mysql";
exit 1;
fi;
if [ ! -f "${ZABBIX_DUMP}" ]; then
echo "[! $(date +'%F %T')] Zabbix dump script could not be found: ${ZABBIX_DUMP}";
if [ ! -f "${ZABBIX_DUMP_BIN}" ]; then
echo "[! $(date +'%F %T')] Zabbix dump script could not be found: ${ZABBIX_DUMP_BIN}";
exit 1;
fi;
# -i (ignore)/ -f (backup)
@@ -54,8 +54,8 @@ BACKUP_SET="zabbix-settings-${BACKUP_SET}";
BACKUP_SET_PREFIX="zabbix-settings-";
# borg call
BORG_CALL=$(echo "${_BORG_CALL}" | sed -e "s/##FILENAME##/${FILENAME}/" | sed -e "s|##REPOSITORY##|${REPOSITORY}|" | sed -e "s/##BACKUP_SET##/${BACKUP_SET}/");
BORG_PRUNE=$(echo "${_BORG_PRUNE}" | sed -e "s|##REPOSITORY##|${REPOSITORY}|" | sed -e "s/##BACKUP_SET_PREFIX##/${BACKUP_SET_PREFIX}/");
BORG_CALL=$(echo "${_BORG_CALL}" | sed -e "s/##FILENAME##/${FILENAME}/" | sed -e "s/##BACKUP_SET##/${BACKUP_SET}/");
BORG_PRUNE=$(echo "${_BORG_PRUNE}" | sed -e "s/##BACKUP_SET_PREFIX##/${BACKUP_SET_PREFIX}/");
# if prefix is emtpy remote "-P"
if [ -z "${BACKUP_SET_PREFIX}" ]; then
BORG_PRUNE=$(echo "${BORG_PRUNE}" | sed -e 's/-P //');