From: "Thomas Bächler" <thomas@archlinux.org>
To: util-linux@vger.kernel.org
Cc: "Thomas Bächler" <thomas@archlinux.org>
Subject: [PATCH] fstrim: add systemd units
Date: Thu, 3 Apr 2014 23:41:51 +0200 [thread overview]
Message-ID: <1396561311-12825-1-git-send-email-thomas@archlinux.org> (raw)
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 | 1 +
sys-utils/Makemodule.am | 6 ++++++
sys-utils/fstrim.service.in | 6 ++++++
sys-utils/fstrim.timer | 10 ++++++++++
4 files changed, 23 insertions(+)
create mode 100644 sys-utils/fstrim.service.in
create mode 100644 sys-utils/fstrim.timer
diff --git a/sys-utils/.gitignore b/sys-utils/.gitignore
index 8d8737a..bcd6e02 100644
--- a/sys-utils/.gitignore
+++ b/sys-utils/.gitignore
@@ -18,3 +18,4 @@ sparc32.8
sparc32bash.8
sparc64.8
x86_64.8
+fstrim.service
diff --git a/sys-utils/Makemodule.am b/sys-utils/Makemodule.am
index ae254a3..1c2b210 100644
--- a/sys-utils/Makemodule.am
+++ b/sys-utils/Makemodule.am
@@ -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
index 0000000..52155d0
--- /dev/null
+++ b/sys-utils/fstrim.service.in
@@ -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
index 0000000..24eeee5
--- /dev/null
+++ b/sys-utils/fstrim.timer
@@ -0,0 +1,10 @@
+[Unit]
+Description=Discard unused blocks once a day
+
+[Timer]
+OnCalendar=daily
+AccuracySec=1h
+Persistent=true
+
+[Install]
+WantedBy=multi-user.target
--
1.9.1
next reply other threads:[~2014-04-03 21:41 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-03 21:41 Thomas Bächler [this message]
2014-04-07 10:43 ` [PATCH] fstrim: add systemd units Karel Zak
2014-04-08 10:25 ` Ruediger Meier
2014-04-08 10:57 ` Thomas Bächler
2014-04-08 12:07 ` Ruediger Meier
2014-04-08 15:42 ` Dave Reisner
2014-04-08 17:12 ` Ruediger Meier
2014-04-09 7:52 ` Karel Zak
2014-04-09 10:07 ` Ruediger Meier
2014-04-09 11:02 ` Karel Zak
2014-04-09 12:12 ` Ruediger Meier
2014-04-09 12:49 ` Thomas Bächler
2014-04-09 15:16 ` Ruediger Meier
2014-04-09 15:24 ` Thomas Bächler
2014-04-09 15:44 ` Ruediger Meier
2014-04-09 14:02 ` Markus Trippelsdorf
2014-04-09 15:48 ` Ruediger Meier
2014-04-09 15:55 ` Markus Trippelsdorf
2014-04-09 18:39 ` Theodore Ts'o
2014-04-10 8:05 ` Karel Zak
2014-04-10 9:17 ` Ruediger Meier
2014-04-10 12:49 ` Karel Zak
2014-04-10 13:16 ` Ruediger Meier
2014-04-10 13:22 ` Ruediger Meier
2014-04-08 17:26 ` Karel Zak
2014-04-08 17:30 ` Thomas Bächler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1396561311-12825-1-git-send-email-thomas@archlinux.org \
--to=thomas@archlinux.org \
--cc=util-linux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox