]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
fstrim: add systemd units
authorThomas Bächler <thomas@archlinux.org>
Thu, 3 Apr 2014 21:41:51 +0000 (23:41 +0200)
committerKarel Zak <kzak@redhat.com>
Mon, 7 Apr 2014 10:38:18 +0000 (12:38 +0200)
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.

sys-utils/.gitignore
sys-utils/Makemodule.am
sys-utils/fstrim.service.in [new file with mode: 0644]
sys-utils/fstrim.timer [new file with mode: 0644]

index 8d8737a31d14fe3514cb872e897005146f16093f..bcd6e0271c9e451353717e0c37e0fdd3729d3bcf 100644 (file)
@@ -18,3 +18,4 @@ sparc32.8
 sparc32bash.8
 sparc64.8
 x86_64.8
+fstrim.service
index ae254a3a1a9ff0bd8fda45d4926a7636f44c6edd..1c2b210a1b52fa482ce18d173dd4350546e26c32 100644 (file)
@@ -53,8 +53,14 @@ dist_man_MANS += sys-utils/fstrim.8
 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
diff --git a/sys-utils/fstrim.service.in b/sys-utils/fstrim.service.in
new file mode 100644 (file)
index 0000000..52155d0
--- /dev/null
@@ -0,0 +1,6 @@
+[Unit]
+Description=Discard unused blocks
+
+[Service]
+Type=oneshot
+ExecStart=@sbindir@/fstrim -a
diff --git a/sys-utils/fstrim.timer b/sys-utils/fstrim.timer
new file mode 100644 (file)
index 0000000..24eeee5
--- /dev/null
@@ -0,0 +1,10 @@
+[Unit]
+Description=Discard unused blocks once a day
+
+[Timer]
+OnCalendar=daily
+AccuracySec=1h
+Persistent=true
+
+[Install]
+WantedBy=multi-user.target