ansible-edda/playbooks/roles/system/zfs/files/scrub/zfs-scrub@.service

19 lines
583 B
SYSTEMD
Raw Normal View History

2022-08-28 04:02:18 +02:00
[Unit]
Description=Zpool scrub on %i
Documentation=man:zpool-scrub(8)
Requires=zfs.target
After=zfs.target
ConditionACPower=true
ConditionPathIsDirectory=/sys/module/zfs
OnFailure=status-mail@%n.service
2023-10-01 19:17:00 +02:00
OnSuccess=status-mail@%n.service
2022-08-28 04:02:18 +02:00
[Service]
EnvironmentFile=-/etc/default/zfs
ExecStart=/bin/sh -c '\
if /usr/sbin/zpool status %i | grep -q "scrub in progress"; then\
exec /usr/sbin/zpool wait -t scrub %i;\
else exec /usr/sbin/zpool scrub -w %i; fi'
ExecStop=-/bin/sh -c '/usr/sbin/zpool scrub -p %i 2>/dev/null || true'
2023-10-01 19:17:00 +02:00
ExecStopPost=/usr/local/sbin/systemd-mail-zpool-status %i