Retry remote commands on failure
This commit is contained in:
parent
4e3b68e13c
commit
579f0ff2dd
20
backup.fish
20
backup.fish
|
@ -40,6 +40,11 @@ sync
|
|||
echo "Sending to target..."
|
||||
for snapshot in $snapshots
|
||||
sudo btrfs send -p $snapshot $snapshot-new | receive-on-target
|
||||
while [ $status != 0 ]
|
||||
echo "Sending failed, retrying..."
|
||||
sleep 5
|
||||
sudo btrfs send -p $snapshot $snapshot-new | receive-on-target
|
||||
end
|
||||
end
|
||||
|
||||
echo "Replacing old snapshots..."
|
||||
|
@ -55,11 +60,26 @@ for pair in $pairs
|
|||
|
||||
if not test -f $mount/.btrfish-keepone
|
||||
rename-target-subvolume $subvol $subvol.(date +%Y-%m-%d)
|
||||
while [ $status != 0 ]
|
||||
echo "Renaming failed, retrying..."
|
||||
sleep 5
|
||||
rename-target-subvolume $subvol $subvol.(date +%Y-%m-%d)
|
||||
end
|
||||
else
|
||||
delete-target-subvolume $subvol
|
||||
while [ $status != 0 ]
|
||||
echo "Deleting failed, retrying..."
|
||||
sleep 5
|
||||
delete-target-subvolume $subvol
|
||||
end
|
||||
end
|
||||
|
||||
rename-target-subvolume $subvol-new $subvol
|
||||
while [ $status != 0 ]
|
||||
echo "Renaming failed, retrying..."
|
||||
sleep 5
|
||||
rename-target-subvolume $subvol-new $subvol
|
||||
end
|
||||
|
||||
sudo rm $mount/.btrfish-lock
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/fish
|
||||
|
||||
set scriptdir (dirname (status --current-filename))
|
||||
set scriptdir (dirname (status --current-filename))
|
||||
|
||||
source $scriptdir/config.fish
|
||||
source $scriptdir/utils.fish
|
||||
|
@ -37,6 +37,11 @@ sync
|
|||
echo "Sending to target..."
|
||||
for snapshot in $snapshots
|
||||
sudo btrfs send $snapshot | receive-on-target
|
||||
while [ $status != 0 ]
|
||||
echo "Sending failed, retrying..."
|
||||
sleep 5
|
||||
sudo btrfs send $snapshot | receive-on-target
|
||||
end
|
||||
end
|
||||
|
||||
echo "Done!"
|
||||
|
|
Loading…
Reference in New Issue