Compare commits

..
Author SHA1 Message Date
cliphouse 8cc12a188b Comment text update 2026-08-27 10:38:10 +09:00
5 changed files with 8 additions and 14 deletions
+4 -5
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,7 +64,6 @@ 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
-5
View File
@@ -10,7 +10,6 @@ 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
@@ -22,13 +21,10 @@ 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
@@ -52,7 +48,6 @@ 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
+1 -1
View File
@@ -155,7 +155,7 @@ SUB_CHECK_INTERVAL="";
# backup set names # backup set names
BACKUP_SET=""; BACKUP_SET="";
SUB_BACKUP_SET=""; SUB_BACKUP_SET="";
# for database backup only # for postgresql database backup only
DATABASE_FULL_DUMP=""; DATABASE_FULL_DUMP="";
DATABASE_USER=""; DATABASE_USER="";
DATABASE_USE_SUDO=""; DATABASE_USE_SUDO="";
+1 -1
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 [ -n "${ZABBIX_UNKNOWN_TABLES}" ]; then if [ ! -z "${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";
+2 -2
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 [ -n "${TARGET_USER}" ] && [ -n "${TARGET_HOST}" ]; then if [ ! -z "${TARGET_USER}" ] && [ ! -z "${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 [ -n "${TARGET_SERVER}" ]; then if [ ! -z "${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