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