File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 3
3
backupScript = pkgs . writeShellScriptBin "backup" ''
4
4
set -x
5
5
DATE=$(date "+%Y%m%d")
6
- sudo btrfs subvol snapshot -r /mnt/root/home /mnt/root/home-$DATE
7
- sudo btrfs subvol snapshot -r /mnt/root/persistent /mnt/root/persistent-$DATE
6
+ if [ ! -d "/mnt/root/home-$DATE" ]; then
7
+ sudo btrfs subvol snapshot -r /mnt/root/home /mnt/root/home-$DATE
8
+ fi
9
+ if [ ! -d "/mnt/root/persistent-$DATE" ]; then
10
+ sudo btrfs subvol snapshot -r /mnt/root/persistent /mnt/root/persistent-$DATE
11
+ fi
8
12
sudo btrfs send /mnt/root/home-$DATE | pv | ssh lt-home-vm.lantian.pub "btrfs receive /mnt/storage/backups"
9
13
sudo btrfs send /mnt/root/persistent-$DATE | pv | ssh lt-home-vm.lantian.pub "btrfs receive /mnt/storage/backups"
10
14
'' ;
You can’t perform that action at this time.
0 commit comments