Compare commits

..

2 Commits

Author SHA1 Message Date
Clemens Schwaighofer
d26de19f92 Fix bug in Postgresql path check 2021-12-16 11:00:22 +09:00
Clemens Schwaighofer
252319848c 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
2021-12-15 12:50:26 +09:00
4 changed files with 10 additions and 11 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

@@ -55,7 +55,7 @@ if [ ! -f "${PG_BASE_PATH}${_PATH_PG_VERSION}/bin/psql" ]; then
PG_BASE_PATH='/usr/pgsql-';
if [ ! -f "${PG_BASE_PATH}${_PATH_PG_VERSION}/bin/psql" ]; then
PG_BASE_PATH='/usr/lib64/pgsql';
_PATH_PG_VERSION=$(echo "${PG_VERSION}" | sed -e 's/\.//'):
_PATH_PG_VERSION=$(echo "${PG_VERSION}" | sed -e 's/\.//');
if [ ! -f "${PG_BASE_PATH}${_PATH_PG_VERSION}/bin/psql" ]; then
echo "[! $(date +'%F %T')] PostgreSQL not found in any paths";
exit 1;

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 //');