add service units

This commit is contained in:
Michael Grote 2023-08-02 20:48:47 +02:00
parent 5f543bb8f9
commit a8ef935a22
4 changed files with 39 additions and 0 deletions

View file

@ -41,6 +41,9 @@ steps:
--depends mbuffer \
--depends build-essential \
--depends git \
sanoid-prune.service=/lib/systemd/system/sanoid-prune.service \
sanoid.service=/lib/systemd/system/sanoid.service \
sanoid.timer=/lib/systemd/system/sanoid.timer \
sanoid=/usr/bin/sanoid \
syncoid=/usr/bin/syncoid \
sanoid.conf=/etc/sanoid/sanoid.conf \

14
sanoid-prune.service Normal file
View file

@ -0,0 +1,14 @@
[Unit]
Description=Prune ZFS snapshots
Documentation=man:sanoid(8)
Requires=local-fs.target
After=local-fs.target sanoid.service
ConditionFileNotEmpty=/etc/sanoid/sanoid.conf
[Service]
Type=oneshot
Environment=TZ=UTC
ExecStart=/usr/sbin/sanoid --prune-snapshots --verbose
[Install]
WantedBy=sanoid.service

13
sanoid.service Normal file
View file

@ -0,0 +1,13 @@
[Unit]
Description=Snapshot ZFS filesystems
Documentation=man:sanoid(8)
Requires=local-fs.target
After=local-fs.target
Before=sanoid-prune.service
Wants=sanoid-prune.service
ConditionFileNotEmpty=/etc/sanoid/sanoid.conf
[Service]
Type=oneshot
Environment=TZ=UTC
ExecStart=/usr/sbin/sanoid --take-snapshots --verbose

9
sanoid.timer Normal file
View file

@ -0,0 +1,9 @@
[Unit]
Description=Run Sanoid Every 15 Minutes
[Timer]
OnCalendar=*:0/15
Persistent=true
[Install]
WantedBy=timers.target