From 9739436589fa6276d6f0969ddf9d17460115be49 Mon Sep 17 00:00:00 2001 From: Clemens Schwaighofer Date: Tue, 31 May 2022 09:54:56 +0900 Subject: [PATCH] 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 --- borg.backup.gitea.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/borg.backup.gitea.sh b/borg.backup.gitea.sh index 96d90ec..076e158 100755 --- a/borg.backup.gitea.sh +++ b/borg.backup.gitea.sh @@ -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}";