Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/nextcloudpi.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthecalcaholic <6317548+theCalcaholic@users.noreply.github.com>2022-09-28 17:00:12 +0300
committerthecalcaholic <6317548+theCalcaholic@users.noreply.github.com>2022-09-28 17:14:02 +0300
commit1499cfbdc28bb2126825d16bc23b8ab01cfe3d85 (patch)
treeee4c5073aad5adf7a8d7e85fd1651cf83c4caaa2
parent6b8501e3aa36e9ef15e3c8abad91c7868fc425ad (diff)
run-parts.sh: Do the backup on shutdown not on startup
Signed-off-by: thecalcaholic <6317548+theCalcaholic@users.noreply.github.com>
-rwxr-xr-xbuild/docker/debian-ncp/run-parts.sh54
1 files changed, 27 insertions, 27 deletions
diff --git a/build/docker/debian-ncp/run-parts.sh b/build/docker/debian-ncp/run-parts.sh
index 0bbfc28a..cae28904 100755
--- a/build/docker/debian-ncp/run-parts.sh
+++ b/build/docker/debian-ncp/run-parts.sh
@@ -5,6 +5,33 @@ cleanup()
for file in $( ls -1rv /etc/services-enabled.d ); do
/etc/services-enabled.d/"$file" stop "$1"
done
+ if [[ -z "$NOBACKUP" ]] || [[ "$NOBACKUP" != "true" ]]
+ then
+ BKPDIR=/data/docker-shutdown-backups/
+ WITH_DATA=no
+ COMPRESSED=yes
+ LIMIT=0
+ mkdir -p "$BKPDIR"
+ echo "Cleanup old shutdown backups..."
+ 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"
+ then
+ echo "Backup stored at '$BKPDIR/$(ls -1t "$BKPDIR"/nextcloud-bkp_*.tar.gz 2>/dev/null | head -n1)'"
+ else
+ echo 'WARN: Backup creation failed'
+ fi
+ set +x
+ fi
exit
}
@@ -17,33 +44,6 @@ if [[ $( ls -1A /data | wc -l ) -eq 0 ]]
then
echo "Initializing empty volume.."
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..."
- 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"
- then
- echo "Backup stored at '$BKPDIR/$(ls -1t "$BKPDIR"/nextcloud-bkp_*.tar.gz 2>/dev/null | head -n1)'"
- else
- echo 'WARN: Backup creation failed'
- fi
- set +x
fi
# wrapper to simulate update-rc.d