Add lock files

This commit is contained in:
Les De Ridder 2016-06-08 16:05:56 +00:00
parent f8ada7688c
commit 79bae2d827
1 changed files with 14 additions and 7 deletions

View File

@ -19,9 +19,16 @@ for pair in (get-subvol-mounts)
set safepath $subvoldir/$safename
if test -d $safepath
sudo btrfs subvolume snapshot -r $mount $safepath-new
if not test -f $mount/.btrfish-lock
sudo btrfs subvolume snapshot -r $mount $safepath-new
set snapshots $snapshots $safepath
sudo touch $mount/.btrfish-lock
set snapshots $snapshots $safepath
set pairs $pairs $pair
else
echo "$mount/.btrfish-lock exists, skipping..."
end
else
echo $mount "is not bootstrapped and will not be included in the backups!"
end
@ -42,13 +49,13 @@ for snapshot in $snapshots
end
echo "Renaming subvolumes on target..."
for pair in (get-subvol-mounts)
for pair in $pairs
set subvol (clean-name (get-subvol $pair))
if test -d $subvoldir/$subvol
rename-target-subvolume $subvol $subvol.(date +%Y-%m-%d)
rename-target-subvolume $subvol-new $subvol
end
rename-target-subvolume $subvol $subvol.(date +%Y-%m-%d)
rename-target-subvolume $subvol-new $subvol
sudo rm (get-mount $pair)/.btrfish-lock
end
echo "Done!"