exit on error
This commit is contained in:
parent
c316e160e5
commit
b71b986f35
4
btrbk.sh
4
btrbk.sh
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue