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