exit on error

This commit is contained in:
snaki 2022-05-25 23:15:42 +02:00
parent c316e160e5
commit b71b986f35
No known key found for this signature in database
GPG key ID: C57B0E9414459801

View file

@ -1,6 +1,7 @@
#!/bin/bash
source config.sh
set -euxo pipefail
function main {
date=$(date +%Y-%m-%d)
@ -10,10 +11,9 @@ function main {
snapName=${VOLNAME[$i]}.$date
snapYest=$SNAPDIR${VOLNAME[$i]}.$(date -d "$date -1 day" +%Y-%m-%d)
btrfs subvolume snapshot -r ${SUBVOLS[$i]} $SNAPDIR$snapName
if [[ -d "$snapYest" && $bkType = daily ]]
if [[ -d "$snapYest" && $bkType = "daily" && $? -ne 0 ]]
then
btrfs send -p $snapYest $SNAPDIR$snapName | gpg --batch -er $PUBKEY -o - | rclone rcat $RCLONEDIR$month/$snapName.pgp
else
btrfs send $SNAPDIR$snapName | gpg --batch -er $PUBKEY -o - | rclone rcat $RCLONEDIR$snapName.pgp
fi