flush: only detect lack of flush support in one place
[zfs.git] / etc / systemd / system / zfs-trim@.service.in
blob423fb448c16f130553783b2b9333dd3af3f1afb4
1 [Unit]
2 Description=zpool trim on %i
3 Documentation=man:zpool-trim(8)
4 Requires=zfs.target
5 After=zfs.target
6 ConditionACPower=true
7 ConditionPathIsDirectory=/sys/module/zfs
9 [Service]
10 EnvironmentFile=-@initconfdir@/zfs
11 ExecStart=/bin/sh -c '\
12 if @sbindir@/zpool status %i | grep -q "(trimming)"; then\
13 exec @sbindir@/zpool wait -t trim %i;\
14 else exec @sbindir@/zpool trim -w %i; fi'
15 ExecStop=-/bin/sh -c '@sbindir@/zpool trim -s %i 2>/dev/null || true'