mirror of https://codeberg.org/anemofilia/zero
operating-systems: buer: shepherd-services: Guard snapshot command with a unless file-exists?, to avoid trying to snapshot /home twice in a day
parent
31f4e5e991
commit
e514737fe3
|
@ -43,11 +43,13 @@ next calendar event.")))
|
|||
#:hours '(8 14 20)
|
||||
#:minutes '(0))
|
||||
(lambda ()
|
||||
(let ((btrfs "/run/current-system/profile/bin/btrfs")
|
||||
(date (strftime "%Y-%m-%d" (localtime (current-time)))))
|
||||
(let* ((btrfs "/run/current-system/profile/bin/btrfs")
|
||||
(date (strftime "%Y-%m-%d" (localtime (current-time))))
|
||||
(snapshot (string-append "/snapshots/home/" date)))
|
||||
(unless (file-exists? snapshot)
|
||||
(spawn-shell-command
|
||||
(string-append btrfs " subvolume snapshot"
|
||||
" /home /snapshots/home/" date))))))
|
||||
(string-join
|
||||
`(btrfs "subvolume snapshot /home" snapshot))))))))
|
||||
(stop #~(make-timer-destructor))
|
||||
(actions (list timer-trigger-action))))
|
||||
|
||||
|
|
Loading…
Reference in New Issue