18 lines
554 B
SYSTEMD
18 lines
554 B
SYSTEMD
|
[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'
|
||
|
ExecStopPost=/bin/sh -c '/usr/local/bin/zpool-status-mail %i'
|