From b5ead9a2e157da035d4f69e772381f3b594a9fbe Mon Sep 17 00:00:00 2001 From: Clemens Schwaighofer Date: Fri, 1 Apr 2022 11:16:38 +0900 Subject: [PATCH] Show host name and module init date in the start info block --- borg.backup.functions.check.sh | 18 ++++++++++++------ borg.backup.functions.init.sh | 3 +++ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/borg.backup.functions.check.sh b/borg.backup.functions.check.sh index 9a9f99c..7780554 100644 --- a/borg.backup.functions.check.sh +++ b/borg.backup.functions.check.sh @@ -2,18 +2,24 @@ # start time in seconds START=$(date +'%s'); +# set init date, or today if not file is set +BACKUP_INIT_DATE=$(printf '%(%c)T' $(cat "${BASE_FOLDER}${BACKUP_INIT_CHECK}" 2>/dev/null)); # start logging from here exec &> >(tee -a "${LOG}"); echo "=== [START : $(date +'%F %T')] ==[${MODULE}]====================================>"; # show info for version always -echo "Script version: ${VERSION}"; +echo "Script version : ${VERSION}"; # show type -echo "Backup module : ${MODULE}"; -echo "Module version: ${MODULE_VERSION}"; +echo "Backup module : ${MODULE}"; +echo "Module version : ${MODULE_VERSION}"; # borg version -echo "Borg version : ${BORG_VERSION}"; +echo "Borg version : ${BORG_VERSION}"; +# host name +echo "Hostname : ${HOSTNAME}"; # show base folder always -echo "Base folder : ${BASE_FOLDER}"; +echo "Base folder : ${BASE_FOLDER}"; +# Module init date (when init file was writen) +echo "Module init date: ${BACKUP_INIT_DATE}"; # if force check is true set CHECK to 1unless INFO is 1 # Needs bash 4.0 at lesat for this @@ -76,7 +82,7 @@ elif [ ! -z "${TARGET_HOST}" ]; then fi; # we dont allow special characters, so we don't need to special escape it REPOSITORY="${TARGET_SERVER}${TARGET_FOLDER}${BACKUP_FILE}"; -echo "Repository : ${REPOSITORY}"; +echo "Repository : ${REPOSITORY}"; # check compression if given is valid and check compression level is valid if given OPT_COMPRESSION=''; diff --git a/borg.backup.functions.init.sh b/borg.backup.functions.init.sh index f8812bf..0f0f403 100644 --- a/borg.backup.functions.init.sh +++ b/borg.backup.functions.init.sh @@ -30,6 +30,8 @@ _LOG_FOLDER="/var/log/borg.backup/"; LOG_FOLDER=""; # should be there on everything TEMPDIR="/tmp/"; +# HOSTNAME (as set on server) +HOSTNAME=$(hostname); # creates borg backup based on the include/exclude files # if base borg folder (backup files) does not exist, it will automatically init it # base folder @@ -41,6 +43,7 @@ INCLUDE_FILE=""; EXCLUDE_FILE=""; # backup folder initialzed check BACKUP_INIT_CHECK=""; +BACKUP_INIT_DATE=""; # one time backup prefix tag, if set will use .-Y-M-DTh:m:s type backup prefix ONE_TIME_TAG=""; DELETE_ONE_TIME_TAG="";