xref: /freebsd/sys/contrib/openzfs/etc/systemd/system/zfs-trim@.service.in (revision 5ca8e32633c4ffbbcd6762e5888b6a4ba0708c6c)
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