Compare commits

...

2 Commits

Author SHA1 Message Date
Clemens Schwaighofer
9739436589 Redirect STDERR output from borg backup to STDIN for ANSI code cleanup
gitea dump prints out info/status messages to STDERR. The whole
subprocess then returns this on STDERR and so is not parsed through the
sed regex command.
Redirect STDERR to STDIN
2022-05-31 09:54:56 +09:00
Clemens Schwaighofer
bf0364a0e7 Move lock file clean up to before any exit info is printed
Just try to clean lock file always on exit
2022-04-25 08:57:01 +09:00
2 changed files with 6 additions and 6 deletions

View File

@@ -7,14 +7,14 @@ fi;
# unset borg settings
unset BORG_BASE_DIR BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK BORG_RELOCATED_REPO_ACCESS_IS_OK
# delete lock file if it exists
if [ -f "${BASE_FOLDER}${BACKUP_LOCK_FILE}" ]; then
rm "${BASE_FOLDER}${BACKUP_LOCK_FILE}";
fi;
# error abort without duration and error notice
if [ $# -ge 1 ] && [ "$1" = "1" ]; then
printf "${PRINTF_MASTER_BLOCK}" "ERROR" "$(date +'%F %T')" "${MODULE}";
else
# delete lock file
if [ -f "${BASE_FOLDER}${BACKUP_LOCK_FILE}" ]; then
rm "${BASE_FOLDER}${BACKUP_LOCK_FILE}";
fi;
# running time calculation
DURATION=$[ $(date +'%s')-$START ];
echo "=== [Run time: $(convert_time ${DURATION})]";

View File

@@ -3,7 +3,7 @@
# Backup gitea database, all git folders and gitea settings
MODULE="gitea"
MODULE_VERSION="1.1.2";
MODULE_VERSION="1.1.3";
DIR="${BASH_SOURCE%/*}"
if [[ ! -d "$DIR" ]]; then DIR="$PWD"; fi
@@ -76,7 +76,7 @@ if [ ${DRYRUN} -eq 0 ]; then
# this needs to be run in a folder that can be stat by git user
cd "${GITEA_TMP}";
sudo -u ${GIT_USER} ${GITEA_BIN} dump -c ${GITEA_CONFIG} -w ${GITEA_TMP} -L -f - | ${BORG_CALL};
) | sed 's/\x1B\[[0-9;]\{1,\}[A-Za-z]//g' # remove all ESC strings
) 2>&1 | sed 's/\x1B\[[0-9;]\{1,\}[A-Za-z]//g' # remove all ESC strings
fi;
if [ -z "${ONE_TIME_TAG}" ]; then
printf "${PRINTF_SUB_BLOCK}" "PRUNE" "$(date +'%F %T')" "${MODULE}";