Compare commits

...

7 Commits

Author SHA1 Message Date
Clemens Schwaighofer
03925562ff Merge branch 'development' into refactor/TTD-3115/shellcheck-cleanup 2025-12-04 11:46:31 +09:00
Clemens Schwaighofer
783bf2adb9 Merge branch 'development' into shellcheck-cleanup 2025-12-02 10:02:17 +09:00
Clemens Schwaighofer
dd2a85f5d6 Merge branch 'development' into shellcheck-cleanup 2025-12-01 18:16:01 +09:00
Clemens Schwaighofer
2e5f0648f1 Merge branch 'development' into shellcheck-cleanup 2025-08-21 10:42:20 +09:00
Clemens Schwaighofer
acd5d369eb Merge branch 'development' into shellcheck-cleanup 2025-08-20 22:41:54 +09:00
Clemens Schwaighofer
de9d5d3588 Zabbix backup set port to 5432 default to override internal set ports 2025-08-20 22:11:38 +09:00
Clemens Schwaighofer
8407defe4f Starting shellcheck cleanup 2024-09-04 10:58:48 +09:00
4 changed files with 13 additions and 7 deletions

View File

@@ -31,16 +31,16 @@ MODULE_LIST="file gitea mysql pgsql zabbix"
# -n for dry run test # -n for dry run test
while getopts ":c:snd" opt; do while getopts ":c:snd" opt; do
case "${opt}" in case "${opt}" in
c|config) c) # config
BASE_FOLDER=${OPTARG}; BASE_FOLDER=${OPTARG};
;; ;;
s|nosudo) s) # nosudo
PGSQL_SUDO=0; PGSQL_SUDO=0;
;; ;;
d|debug) d) # debug
DEBUG=1; DEBUG=1;
;; ;;
n|dryrun) n) # dryrun
DRYRUN=1; DRYRUN=1;
;; ;;
:) :)
@@ -64,6 +64,7 @@ if [ ! -f "${BASE_FOLDER}${SETTINGS_FILE}" ]; then
echo "Could not find: ${BASE_FOLDER}${SETTINGS_FILE}"; echo "Could not find: ${BASE_FOLDER}${SETTINGS_FILE}";
exit; exit;
fi; fi;
# shellcheck source="borg.backup.settings"
. "${BASE_FOLDER}${SETTINGS_FILE}"; . "${BASE_FOLDER}${SETTINGS_FILE}";
if [ -n "${TARGET_BORG_PATH}" ]; then if [ -n "${TARGET_BORG_PATH}" ]; then

View File

@@ -10,6 +10,7 @@ fi;
# compact (only if BORG COMPACT is set) # compact (only if BORG COMPACT is set)
# only for borg 1.2 # only for borg 1.2
if [ "$(version "$BORG_VERSION")" -ge "$(version "1.2.0")" ]; then
if [ "$(version "$BORG_VERSION")" -ge "$(version "1.2.0")" ]; then if [ "$(version "$BORG_VERSION")" -ge "$(version "1.2.0")" ]; then
RUN_COMPACT=0; RUN_COMPACT=0;
if [ $# -ge 1 ] && [ "$1" = "auto" ]; then if [ $# -ge 1 ] && [ "$1" = "auto" ]; then
@@ -21,10 +22,13 @@ if [ "$(version "$BORG_VERSION")" -ge "$(version "1.2.0")" ]; then
fi; fi;
# get current date timestmap # get current date timestmap
CURRENT_DATE=$(date +%s); CURRENT_DATE=$(date +%s);
if [ "${COMPACT_INTERVAL}" -eq 1 ]; then
if [ "${COMPACT_INTERVAL}" -eq 1 ]; then if [ "${COMPACT_INTERVAL}" -eq 1 ]; then
RUN_COMPACT=1; RUN_COMPACT=1;
# set new compact time here # set new compact time here
echo "${CURRENT_DATE}" > "${BASE_FOLDER}${BACKUP_COMPACT_FILE}"; echo "${CURRENT_DATE}" > "${BASE_FOLDER}${BACKUP_COMPACT_FILE}";
elif [ "${COMPACT_INTERVAL}" -gt 1 ]; then
echo "${CURRENT_DATE}" > "${BASE_FOLDER}${BACKUP_COMPACT_FILE}";
elif [ "${COMPACT_INTERVAL}" -gt 1 ]; then elif [ "${COMPACT_INTERVAL}" -gt 1 ]; then
# else load last timestamp and check if today - last time stamp > days # else load last timestamp and check if today - last time stamp > days
if [ -z "${LAST_COMPACT_DATE}" ]; then if [ -z "${LAST_COMPACT_DATE}" ]; then
@@ -48,6 +52,7 @@ if [ "$(version "$BORG_VERSION")" -ge "$(version "1.2.0")" ]; then
if [ "${RUN_COMPACT}" -eq 1 ]; then if [ "${RUN_COMPACT}" -eq 1 ]; then
# reset to normal IFS, so command works here # reset to normal IFS, so command works here
IFS=${_IFS}; IFS=${_IFS};
# shellcheck disable=SC2059
printf "${PRINTF_SUB_BLOCK}" "COMPACT" "$(date +'%F %T')" "${MODULE}"; printf "${PRINTF_SUB_BLOCK}" "COMPACT" "$(date +'%F %T')" "${MODULE}";
BORG_COMPACT="${BORG_COMMAND} compact ${OPT_REMOTE} -v ${OPT_PROGRESS} ${REPOSITORY}"; BORG_COMPACT="${BORG_COMMAND} compact ${OPT_REMOTE} -v ${OPT_PROGRESS} ${REPOSITORY}";
if [ "${DEBUG}" -eq 1 ]; then if [ "${DEBUG}" -eq 1 ]; then

View File

@@ -55,7 +55,7 @@ if [ ! -f "${ZABBIX_DUMP_BIN}" ]; then
exit 1; exit 1;
fi; fi;
# -i (ignore)/ -f (backup) # -i (ignore)/ -f (backup)
if [ ! -z "${ZABBIX_UNKNOWN_TABLES}" ]; then if [ -n "${ZABBIX_UNKNOWN_TABLES}" ]; then
OPT_ZABBIX_UNKNOWN_TABLES="-f"; OPT_ZABBIX_UNKNOWN_TABLES="-f";
else else
OPT_ZABBIX_UNKNOWN_TABLES="-i"; OPT_ZABBIX_UNKNOWN_TABLES="-i";

View File

@@ -80,7 +80,7 @@ if [ ${UMOUNT} -eq 0 ]; then
. ${BASE_FOLDER}${SETTINGS_FILE} . ${BASE_FOLDER}${SETTINGS_FILE}
# set the borg backup file base on the settings data # set the borg backup file base on the settings data
# if we have user/host then we build the ssh command # if we have user/host then we build the ssh command
if [ ! -z "${TARGET_USER}" ] && [ ! -z "${TARGET_HOST}" ]; then if [ -n "${TARGET_USER}" ] && [ -n "${TARGET_HOST}" ]; then
TARGET_SERVER=${TARGET_USER}"@"${TARGET_HOST}":"; TARGET_SERVER=${TARGET_USER}"@"${TARGET_HOST}":";
fi; fi;
REPOSITORY=${TARGET_SERVER}${TARGET_FOLDER}${BACKUP_FILE}; REPOSITORY=${TARGET_SERVER}${TARGET_FOLDER}${BACKUP_FILE};
@@ -90,7 +90,7 @@ if [ ${UMOUNT} -eq 0 ]; then
# check that the repostiory exists # check that the repostiory exists
REPOSITORY_OK=0; REPOSITORY_OK=0;
if [ ! -z "${TARGET_SERVER}" ]; then if [ -n "${TARGET_SERVER}" ]; then
# remove trailing : for this # remove trailing : for this
TARGET_SERVER=${TARGET_SERVER/:}; TARGET_SERVER=${TARGET_SERVER/:};
# use ssh command to check remote existense # use ssh command to check remote existense