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

18 lines
563 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
[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'
2022-08-30 20:27:32 +02:00
ExecStopPost=/bin/sh -c '/usr/local/sbin/systemd-mail-zpool-status %i'