2021-12-16 19:47:22 +00:00
|
|
|
[Unit]
|
|
|
|
Description=zpool scrub on %i
|
|
|
|
Documentation=man:zpool-scrub(8)
|
|
|
|
Requires=zfs.target
|
|
|
|
After=zfs.target
|
|
|
|
ConditionACPower=true
|
|
|
|
ConditionPathIsDirectory=/sys/module/zfs
|
|
|
|
|
|
|
|
[Service]
|
2022-02-22 20:59:11 +00:00
|
|
|
EnvironmentFile=-@initconfdir@/zfs
|
2021-12-16 19:47:22 +00:00
|
|
|
ExecStart=/bin/sh -c '\
|
2022-02-22 20:59:11 +00:00
|
|
|
if @sbindir@/zpool status %i | grep -q "scrub in progress"; then\
|
2021-12-16 19:47:22 +00:00
|
|
|
exec @sbindir@/zpool wait -t scrub %i;\
|
|
|
|
else exec @sbindir@/zpool scrub -w %i; fi'
|
|
|
|
ExecStop=-/bin/sh -c '@sbindir@/zpool scrub -p %i 2>/dev/null || true'
|