xref: /freebsd/sys/contrib/openzfs/etc/systemd/system/zfs-scrub@.service.in (revision 13ec1e3155c7e9bf037b12af186351b7fa9b9450)
1[Unit]
2Description=zpool scrub on %i
3Documentation=man:zpool-scrub(8)
4Requires=zfs.target
5After=zfs.target
6ConditionACPower=true
7ConditionPathIsDirectory=/sys/module/zfs
8
9[Service]
10ExecStart=/bin/sh -c '\
11if @sbindir@/zpool status %i | grep "scrub in progress"; then\
12exec @sbindir@/zpool wait -t scrub %i;\
13else exec @sbindir@/zpool scrub -w %i; fi'
14ExecStop=-/bin/sh -c '@sbindir@/zpool scrub -p %i 2>/dev/null || true'
15