2021-12-16 22:47:22 +03: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 23:59:11 +03:00
|
|
|
EnvironmentFile=-@initconfdir@/zfs
|
2021-12-16 22:47:22 +03:00
|
|
|
ExecStart=/bin/sh -c '\
|
2022-02-22 23:59:11 +03:00
|
|
|
if @sbindir@/zpool status %i | grep -q "scrub in progress"; then\
|
2021-12-16 22:47:22 +03: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'
|