This adds a timer and a service for systemd that runs
fstrim -a once a day.
The Persistent=true option used will only work on systemd 212
or newer.
sparc32bash.8
sparc64.8
x86_64.8
+fstrim.service
fstrim_SOURCES = sys-utils/fstrim.c
fstrim_LDADD = $(LDADD) libcommon.la libmount.la
fstrim_CFLAGS = $(AM_CFLAGS) -I$(ul_libmount_incdir)
+systemdsystemunit_DATA += \
+ sys-utils/fstrim.service \
+ sys-utils/fstrim.timer
endif
+PATHFILES += \
+ sys-utils/fstrim.service
+
if LINUX
#
# Linux-only utils with no another dependencies. All another dependencies have
--- /dev/null
+[Unit]
+Description=Discard unused blocks
+
+[Service]
+Type=oneshot
+ExecStart=@sbindir@/fstrim -a
--- /dev/null
+[Unit]
+Description=Discard unused blocks once a day
+
+[Timer]
+OnCalendar=daily
+AccuracySec=1h
+Persistent=true
+
+[Install]
+WantedBy=multi-user.target