summaryrefslogtreecommitdiff
path: root/init
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2018-12-06 17:37:34 +0000
committerColin Watson <cjwatson@debian.org>2018-12-06 17:55:21 +0000
commitbc52248f8756ac210c583539fdb515dc3d6628f6 (patch)
tree1d2742e4654693a86295af5ed97f15ff9e3b0718 /init
parentd272bc3e81db44100467f720689ca2992d19f976 (diff)
Ship a systemd timer for daily DB maintenance
Thanks to Christian Göttsche. Fixes Debian bug #858022. * m4/man-arg-systemdsystemunitdir.m4: New file. * configure.ac: Accept --with-systemdsystemunitdir option. * init/systemd/Makefile.am (EXTRA_DIST): Add man-db.service.in. (CLEANFILES): Add man-db.service. (systemdsystemunit_DATA): Install man-db.timer. (nodist_systemdsystemunit_DATA): Install man-db.service. (man-db.service): New rule. * init/systemd/man-db.service.in, init/systemd/man-db.timer: New files. * .gitignore: Add init/systemd/man-db.service. * NEWS: Document this.
Diffstat (limited to 'init')
-rw-r--r--init/systemd/Makefile.am14
-rw-r--r--init/systemd/man-db.service.in16
-rw-r--r--init/systemd/man-db.timer11
3 files changed, 39 insertions, 2 deletions
diff --git a/init/systemd/Makefile.am b/init/systemd/Makefile.am
index a79caf10..67397b58 100644
--- a/init/systemd/Makefile.am
+++ b/init/systemd/Makefile.am
@@ -18,11 +18,21 @@
## along with man-db; if not, write to the Free Software Foundation,
## Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-EXTRA_DIST = man-db.conf.in
+EXTRA_DIST = \
+ man-db.conf.in \
+ man-db.service.in
-CLEANFILES = man-db.conf
+CLEANFILES = \
+ man-db.conf \
+ man-db.service
nodist_systemdtmpfiles_DATA = man-db.conf
+systemdsystemunit_DATA = man-db.timer
+nodist_systemdsystemunit_DATA = man-db.service
+
man-db.conf: man-db.conf.in
sed -e "s,[@]cache_top_owner[@],$(cache_top_owner),g" $< > $@
+
+man-db.service: man-db.service.in
+ sed -e "s,[@]bindir[@],$(bindir),g" $< > $@
diff --git a/init/systemd/man-db.service.in b/init/systemd/man-db.service.in
new file mode 100644
index 00000000..ba66585f
--- /dev/null
+++ b/init/systemd/man-db.service.in
@@ -0,0 +1,16 @@
+[Unit]
+Description=Daily man-db regeneration
+Documentation=man:mandb(8)
+ConditionACPower=true
+
+[Service]
+Type=oneshot
+ExecStart=+/usr/bin/install -d -o man -g man -m 0755 /var/cache/man
+# Expunge old catman pages which have not been read in a week.
+ExecStart=/usr/bin/find /var/cache/man -type f -name *.gz -atime +6 -delete
+# Regenerate man database.
+ExecStart=@bindir@/mandb
+User=man
+Nice=19
+IOSchedulingClass=idle
+IOSchedulingPriority=7
diff --git a/init/systemd/man-db.timer b/init/systemd/man-db.timer
new file mode 100644
index 00000000..b0f7964b
--- /dev/null
+++ b/init/systemd/man-db.timer
@@ -0,0 +1,11 @@
+[Unit]
+Description=Daily man-db regeneration
+Documentation=man:mandb(8)
+
+[Timer]
+OnCalendar=daily
+AccuracySec=12h
+Persistent=true
+
+[Install]
+WantedBy=timers.target