Add lock files
This commit is contained in:
parent
f8ada7688c
commit
79bae2d827
21
backup.fish
21
backup.fish
|
@ -19,9 +19,16 @@ for pair in (get-subvol-mounts)
|
||||||
set safepath $subvoldir/$safename
|
set safepath $subvoldir/$safename
|
||||||
|
|
||||||
if test -d $safepath
|
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
|
else
|
||||||
echo $mount "is not bootstrapped and will not be included in the backups!"
|
echo $mount "is not bootstrapped and will not be included in the backups!"
|
||||||
end
|
end
|
||||||
|
@ -42,13 +49,13 @@ for snapshot in $snapshots
|
||||||
end
|
end
|
||||||
|
|
||||||
echo "Renaming subvolumes on target..."
|
echo "Renaming subvolumes on target..."
|
||||||
for pair in (get-subvol-mounts)
|
for pair in $pairs
|
||||||
set subvol (clean-name (get-subvol $pair))
|
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 $subvol.(date +%Y-%m-%d)
|
rename-target-subvolume $subvol-new $subvol
|
||||||
rename-target-subvolume $subvol-new $subvol
|
|
||||||
end
|
sudo rm (get-mount $pair)/.btrfish-lock
|
||||||
end
|
end
|
||||||
|
|
||||||
echo "Done!"
|
echo "Done!"
|
||||||
|
|
Loading…
Reference in New Issue