Add lock files
This commit is contained in:
parent
f8ada7688c
commit
79bae2d827
13
backup.fish
13
backup.fish
|
@ -19,9 +19,16 @@ for pair in (get-subvol-mounts)
|
|||
set safepath $subvoldir/$safename
|
||||
|
||||
if test -d $safepath
|
||||
if not test -f $mount/.btrfish-lock
|
||||
sudo btrfs subvolume snapshot -r $mount $safepath-new
|
||||
|
||||
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
|
||||
|
||||
sudo rm (get-mount $pair)/.btrfish-lock
|
||||
end
|
||||
|
||||
echo "Done!"
|
||||
|
|
Loading…
Reference in New Issue