18 lines
513 B
Desktop File
18 lines
513 B
Desktop File
[Unit]
|
|
Description=Zpool trim on %i
|
|
Documentation=man:zpool-trim(8)
|
|
Requires=zfs.target
|
|
After=zfs.target
|
|
ConditionACPower=true
|
|
ConditionPathIsDirectory=/sys/module/zfs
|
|
OnFailure=status-mail@%n.service
|
|
OnSuccess=status-mail@%n.service
|
|
|
|
[Service]
|
|
EnvironmentFile=-/etc/default/zfs
|
|
ExecStart=/bin/sh -c '\
|
|
if /usr/sbin/zpool status %i | grep -q "(trimming)"; then\
|
|
exec /usr/sbin/zpool wait -t trim %i;\
|
|
else exec /usr/sbin/zpool trim -w %i; fi'
|
|
ExecStop=-/bin/sh -c '/usr/sbin/zpool trim -s %i 2>/dev/null || true'
|