xref: /freebsd/sys/contrib/openzfs/etc/systemd/system/zfs-scrub@.service.in (revision c03c5b1c80914ec656fbee84539355d1fad68bf9)
1e92ffd9bSMartin Matuska[Unit]
2e92ffd9bSMartin MatuskaDescription=zpool scrub on %i
3e92ffd9bSMartin MatuskaDocumentation=man:zpool-scrub(8)
4e92ffd9bSMartin MatuskaRequires=zfs.target
5e92ffd9bSMartin MatuskaAfter=zfs.target
6e92ffd9bSMartin MatuskaConditionACPower=true
7e92ffd9bSMartin MatuskaConditionPathIsDirectory=/sys/module/zfs
8e92ffd9bSMartin Matuska
9e92ffd9bSMartin Matuska[Service]
10*c03c5b1cSMartin MatuskaEnvironmentFile=-@initconfdir@/zfs
11e92ffd9bSMartin MatuskaExecStart=/bin/sh -c '\
12*c03c5b1cSMartin Matuskaif @sbindir@/zpool status %i | grep -q "scrub in progress"; then\
13e92ffd9bSMartin Matuskaexec @sbindir@/zpool wait -t scrub %i;\
14e92ffd9bSMartin Matuskaelse exec @sbindir@/zpool scrub -w %i; fi'
15e92ffd9bSMartin MatuskaExecStop=-/bin/sh -c '@sbindir@/zpool scrub -p %i 2>/dev/null || true'
16