diff options
author | nachoparker <nacho@ownyourbits.com> | 2018-05-15 06:20:06 +0300 |
---|---|---|
committer | nachoparker <nacho@ownyourbits.com> | 2018-05-15 07:13:06 +0300 |
commit | 191ea16ec9bf403e516eb67c5fccebf86e9ace65 (patch) | |
tree | c48be38fec6c21d17d63d5096caaefe19c0cbbaf /bin/ncp-update-nc | |
parent | 2507cc6298956893dad2f81bffb6b85376eaf5b9 (diff) |
nc-update-netcloud: include version in backup namev0.55.3
Diffstat (limited to 'bin/ncp-update-nc')
-rw-r--r-- | bin/ncp-update-nc | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/bin/ncp-update-nc b/bin/ncp-update-nc index cb737c3c..413da12d 100644 --- a/bin/ncp-update-nc +++ b/bin/ncp-update-nc @@ -66,7 +66,6 @@ cleanup() { set +eE echo "Clean up..." rm -rf /var/www/nextcloud.tar.bz2 /var/www/nextcloud-old - sudo -u www-data php /var/www/nextcloud/occ maintenance:mode --off trap "" EXIT exit $RET } @@ -85,17 +84,17 @@ WITH_DATA=no COMPRESSED=yes LIMIT=0 -sudo -u www-data php /var/www/nextcloud/occ maintenance:mode --on - echo "Back up current instance..." set +eE ncp-backup "$BKPDIR" "$WITH_DATA" "$COMPRESSED" "$LIMIT" # && false # test point RET=$? set -eE -BKP="$( ls -1t "$BKPDIR"/nextcloud-bkp_*.tar.gz 2>/dev/null | head -1 )" -[[ -f "$BKP" ]] || { set +eE; echo "Error backing up"; false || cleanup; } -[[ $RET -ne 0 ]] && { rm -f "$BKP"; set +eE; echo "Error backing up"; false || cleanup; } +BKP_="$( ls -1t "$BKPDIR"/nextcloud-bkp_*.tar.gz 2>/dev/null | head -1 )" +[[ -f "$BKP_" ]] || { set +eE; echo "Error backing up"; false || cleanup; } +[[ $RET -ne 0 ]] && { rm -f "$BKP_"; set +eE; echo "Error backing up"; false || cleanup; } +BKP="$( dirname "$BKP_" )/$( basename "$BKP_" .tar.gz )-${CURRENT}.tar.gz" +mv "$BKP_" "$BKP" # simple restore if anything fails from here #################### |