Update backup script to start a new backup, but replace the old
This commit is contained in:
parent
45ec0d7a89
commit
44820bdd75
1 changed files with 12 additions and 1 deletions
|
@ -9,6 +9,7 @@ fi
|
||||||
|
|
||||||
pushd /var/backup &>/dev/null || exit 2
|
pushd /var/backup &>/dev/null || exit 2
|
||||||
|
|
||||||
|
echo "Creating stage4 backup in /var/backup/$bhost-stage4.zst"
|
||||||
mkstage4 -s -l -q -C zst \
|
mkstage4 -s -l -q -C zst \
|
||||||
-e "/var/lib/containers/*" \
|
-e "/var/lib/containers/*" \
|
||||||
-e "/var/lib/machines/*" \
|
-e "/var/lib/machines/*" \
|
||||||
|
@ -16,6 +17,16 @@ mkstage4 -s -l -q -C zst \
|
||||||
-e "/var/lib/libvirt/*" \
|
-e "/var/lib/libvirt/*" \
|
||||||
-e "/var/cache/binpkgs/*" \
|
-e "/var/cache/binpkgs/*" \
|
||||||
-e "/home/*/*" \
|
-e "/home/*/*" \
|
||||||
"$bhost-stage4"
|
"$bhost-stage4-$bdate"
|
||||||
|
|
||||||
|
if [[ "$?" -ne 0 ]]; then
|
||||||
|
echo "ERROR: Backup failure"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
if [[ -f "/var/backup/$bhost-stage4.zst" ]]; then
|
||||||
|
rm -f "/var/backup/$bhost-stage4.zst"
|
||||||
|
fi
|
||||||
|
mv "/var/backup/$bhost-stage4-$bdate.zst" "/var/backup/$bhost-stage4.zst"
|
||||||
|
fi
|
||||||
|
|
||||||
popd &>/dev/null || exit 2
|
popd &>/dev/null || exit 2
|
||||||
|
|
Loading…
Reference in a new issue