mirror_zfs/etc/systemd/system/zfs-scrub@.service.in
Dimitri John Ledkov 79b20949b2
systemd: Use non-absolute paths in Exec* lines
Since systemd v239, Exec* binaries are resolved from PATH when they
are not-absolute. Switch to this by default for ease of downstream
maintenance. Many downstream distributions move individual binaries
to locations that existing compile-time configurations cannot
accommodate.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
Closes #14880
2023-05-24 12:31:28 -07:00

16 lines
410 B
SYSTEMD

[Unit]
Description=zpool scrub on %i
Documentation=man:zpool-scrub(8)
Requires=zfs.target
After=zfs.target
ConditionACPower=true
ConditionPathIsDirectory=/sys/module/zfs
[Service]
EnvironmentFile=-@initconfdir@/zfs
ExecStart=sh -c '\
if zpool status %i | grep -q "scrub in progress"; then\
exec zpool wait -t scrub %i;\
else exec zpool scrub -w %i; fi'
ExecStop=-sh -c 'zpool scrub -p %i 2>/dev/null || true'