Declare that sanoid service 'Wants' sanoid-prune

Also add --verbose flag for logging as mentioned in readme.

sanoid-prune.service never runs. Declare a 'Wants' dependency,
and 'Before' condition in the sanoid unit, and prune is run
after 'sanoid.service'.
This commit is contained in:
John Ramsden 2019-04-20 15:31:00 -07:00
parent dd47dd5368
commit ce93d89ec8
No known key found for this signature in database
GPG Key ID: 76E9530653FE701A
3 changed files with 6 additions and 2 deletions

View File

@ -78,6 +78,8 @@ cat << "EOF" | sudo tee /etc/systemd/system/sanoid.service
Description=Snapshot ZFS Pool
Requires=zfs.target
After=zfs.target
Wants=sanoid-prune.service
Before=sanoid-prune.service
ConditionFileNotEmpty=/etc/sanoid/sanoid.conf
[Service]

View File

@ -7,7 +7,7 @@ ConditionFileNotEmpty=/etc/sanoid/sanoid.conf
[Service]
Environment=TZ=UTC
Type=oneshot
ExecStart=/usr/sbin/sanoid --prune-snapshots
ExecStart=/usr/sbin/sanoid --prune-snapshots --verbose
[Install]
WantedBy=sanoid.service

View File

@ -2,9 +2,11 @@
Description=Snapshot ZFS Pool
Requires=zfs.target
After=zfs.target
Wants=sanoid-prune.service
Before=sanoid-prune.service
ConditionFileNotEmpty=/etc/sanoid/sanoid.conf
[Service]
Environment=TZ=UTC
Type=oneshot
ExecStart=/usr/sbin/sanoid --take-snapshots
ExecStart=/usr/sbin/sanoid --take-snapshots --verbose