mirror_zfs/etc/systemd/system/zfs-trim@.service.in

16 lines
398 B
SYSTEMD
Raw Normal View History

[Unit]
Description=zpool trim on %i
Documentation=man:zpool-trim(8)
Requires=zfs.target
After=zfs.target
ConditionACPower=true
ConditionPathIsDirectory=/sys/module/zfs
[Service]
EnvironmentFile=-@initconfdir@/zfs
ExecStart=sh -c '\
if zpool status %i | grep -q "(trimming)"; then\
exec zpool wait -t trim %i;\
else exec zpool trim -w %i; fi'
ExecStop=-sh -c 'zpool trim -s %i 2>/dev/null || true'