diff options
author | thecalcaholic <6317548+theCalcaholic@users.noreply.github.com> | 2022-09-28 16:43:28 +0300 |
---|---|---|
committer | thecalcaholic <6317548+theCalcaholic@users.noreply.github.com> | 2022-09-28 17:14:01 +0300 |
commit | 6b8501e3aa36e9ef15e3c8abad91c7868fc425ad (patch) | |
tree | e02ee63310f0925c049f4b667d17f48e11b75bb4 | |
parent | 9b5fbba51776017d9b9b12de3ad93a86aa4c51c7 (diff) |
run-parts.sh: Enable debug output during backups
Signed-off-by: thecalcaholic <6317548+theCalcaholic@users.noreply.github.com>
-rwxr-xr-x | build/docker/debian-ncp/run-parts.sh | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/build/docker/debian-ncp/run-parts.sh b/build/docker/debian-ncp/run-parts.sh index 4a01146e..0bbfc28a 100755 --- a/build/docker/debian-ncp/run-parts.sh +++ b/build/docker/debian-ncp/run-parts.sh @@ -19,17 +19,22 @@ then cp -raT /data-ro /data elif [[ -z "$NOBACKUP" ]] || [[ "$NOBACKUP" != "true" ]] then + set -x BKPDIR=/data/ncp-startup-backups/ WITH_DATA=no COMPRESSED=yes LIMIT=0 mkdir -p "$BKPDIR" echo "Cleanup old startup backups..." - BKPS="$(ls -1t "$BKPDIR"/nextcloud-bkp_*.tar.gz 2>/dev/null || true)" - while read -r bkp - do - rm -f "$BKPDIR/$bkp" - done <"$(echo "$BKPS" | tail -n +5)" + skip_bkp_cleanup=0 + BKPS="$(ls -1t "$BKPDIR"/nextcloud-bkp_*.tar.gz 2>/dev/null || skip_bkp_cleanup=1)" + if [[ "$skip_bkp_cleanup" == 0 ]] + then + while read -r bkp + do + rm -f "$BKPDIR/$bkp" + done <"$(echo "$BKPS" | tail -n +5)" + fi echo "Back up current instance..." set +eE if ncp-backup "$BKPDIR" "$WITH_DATA" "$COMPRESSED" "$LIMIT" @@ -38,6 +43,7 @@ then else echo 'WARN: Backup creation failed' fi + set +x fi # wrapper to simulate update-rc.d |