diff options
Diffstat (limited to 'etc/systemd/system/[email protected]')
-rw-r--r-- | etc/systemd/system/[email protected] | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/etc/systemd/system/[email protected] b/etc/systemd/system/[email protected] new file mode 100644 index 000000000..bebe91d74 --- /dev/null +++ b/etc/systemd/system/[email protected] @@ -0,0 +1,14 @@ +[Unit] +Description=zpool scrub on %i +Documentation=man:zpool-scrub(8) +Requires=zfs.target +After=zfs.target +ConditionACPower=true +ConditionPathIsDirectory=/sys/module/zfs + +[Service] +ExecStart=/bin/sh -c '\ +if @sbindir@/zpool status %i | grep "scrub in progress"; then\ +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' |