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