[debian-edu-commits] [Git][debian-edu/upstream/sitesummary][personal/gber/munin-systemd] 2 commits: Add systemd timer unit for sitesummary-client
Guido Berhörster (@gber)
gitlab at salsa.debian.org
Fri Jul 21 07:19:50 BST 2023
Guido Berhörster pushed to branch personal/gber/munin-systemd at Debian Edu / upstream / sitesummary
Commits:
2fd192c3 by Guido Berhoerster at 2023-07-21T08:18:51+02:00
Add systemd timer unit for sitesummary-client
This replaces the init script for systemd-based installations.
Closes: #1039369
- - - - -
6a9ea82e by Guido Berhoerster at 2023-07-21T08:19:15+02:00
Add systemd timer for sitesummary maintenance
- - - - -
8 changed files:
- debian/rules
- + debian/sitesummary-client.sitesummary-client.service
- + debian/sitesummary-client.sitesummary-client.timer
- + debian/sitesummary-maintenance
- debian/sitesummary.cron.daily
- debian/sitesummary.install
- + debian/sitesummary.sitesummary.service
- + debian/sitesummary.sitesummary.timer
Changes:
=====================================
debian/rules
=====================================
@@ -7,3 +7,7 @@
# No need to submit information when the package is installed
override_dh_installinit:
dh_installinit --no-start
+
+override_dh_installsystemd:
+ dh_installsystemd --no-start --name sitesummary
+ dh_installsystemd --no-start --name sitesummary-client
=====================================
debian/sitesummary-client.sitesummary-client.service
=====================================
@@ -0,0 +1,10 @@
+[Unit]
+Description=Report status to sitesummary server after boot
+After=network-online.target
+
+[Service]
+Type=oneshot
+EnvironmentFile=-/etc/environment
+EnvironmentFile=-/etc/default/sitesummary-client
+Nice=10
+ExecStart=/usr/sbin/sitesummary-client
=====================================
debian/sitesummary-client.sitesummary-client.timer
=====================================
@@ -0,0 +1,8 @@
+[Unit]
+Description=Timer for sitesummary reporting after boot
+
+[Timer]
+OnBootSec=5min
+
+[Install]
+WantedBy=timers.target
=====================================
debian/sitesummary-maintenance
=====================================
@@ -0,0 +1,39 @@
+#!/bin/sh
+#
+# Author: Petter Reinholdtsen
+
+set -e
+
+daylimit=120
+makewebreport=/usr/sbin/sitesummary-makewebreport
+nodes=/usr/sbin/sitesummary-nodes
+
+[ -f /etc/sitesummary/collector.cfg ] && . /etc/sitesummary/collector.cfg
+
+# Exit imediately if the package is removed but nor purged
+if [ ! -x $nodes ] ; then
+ exit 0
+fi
+
+# The storage area is not configurable, because too many scripts have
+# it hardcoded
+entriesdir=/var/lib/sitesummary/entries
+
+remove_old_entries() {
+ find $entriesdir/. -mindepth 1 -maxdepth 1 -type d \
+ -daystart -mtime +$daylimit \
+ -exec /usr/lib/sitesummary/expire-entry '{}' \;
+}
+
+[ -d $entriesdir ] && remove_old_entries
+
+if [ -x /usr/sbin/sitesummary-update-nagios ] ; then
+ /usr/sbin/sitesummary-update-nagios
+fi
+
+if [ -x /usr/sbin/sitesummary-update-munin ] ; then
+ /usr/sbin/sitesummary-update-munin
+fi
+
+# Update the web report once a day
+[ -x $makewebreport ] && nice $makewebreport
=====================================
debian/sitesummary.cron.daily
=====================================
@@ -1,39 +1,8 @@
#!/bin/sh
-#
-# Author: Petter Reinholdtsen
-set -e
-
-daylimit=120
-makewebreport=/usr/sbin/sitesummary-makewebreport
-nodes=/usr/sbin/sitesummary-nodes
-
-[ -f /etc/sitesummary/collector.cfg ] && . /etc/sitesummary/collector.cfg
-
-# Exit imediately if the package is removed but nor purged
-if [ ! -x $nodes ] ; then
- exit 0
+# Do not run on systemd-based installations or if the package is removed but
+# not purged
+if [ -x /usr/lib/sitesummary/sitesummary-maintenance ] && \
+ [ ! -d /run/systemd/system ]; then
+ /usr/lib/sitesummary/sitesummary-maintenance
fi
-
-# The storage area is not configurable, because too many scripts have
-# it hardcoded
-entriesdir=/var/lib/sitesummary/entries
-
-remove_old_entries() {
- find $entriesdir/. -mindepth 1 -maxdepth 1 -type d \
- -daystart -mtime +$daylimit \
- -exec /usr/lib/sitesummary/expire-entry '{}' \;
-}
-
-[ -d $entriesdir ] && remove_old_entries
-
-if [ -x /usr/sbin/sitesummary-update-nagios ] ; then
- /usr/sbin/sitesummary-update-nagios
-fi
-
-if [ -x /usr/sbin/sitesummary-update-munin ] ; then
- /usr/sbin/sitesummary-update-munin
-fi
-
-# Update the web report once a day
-[ -x $makewebreport ] && nice $makewebreport
=====================================
debian/sitesummary.install
=====================================
@@ -8,3 +8,4 @@ usr/sbin/sitesummary-nodes
usr/sbin/sitesummary-update-munin
usr/sbin/sitesummary-update-nagios
usr/share/munin/plugins
+debian/sitesummary-maintenance usr/lib/sitesummary/sitesummary-maintenance
=====================================
debian/sitesummary.sitesummary.service
=====================================
@@ -0,0 +1,6 @@
+[Unit]
+Description=Regular sitesummary maintenance
+
+[Service]
+Type=oneshot
+ExecStart=/usr/lib/sitesummary/sitesummary-maintenance
=====================================
debian/sitesummary.sitesummary.timer
=====================================
@@ -0,0 +1,9 @@
+[Unit]
+Description=Timer for regular sitesummary maintenance
+
+[Timer]
+OnCalendar=daily
+Persistent=true
+
+[Install]
+WantedBy=timers.target
View it on GitLab: https://salsa.debian.org/debian-edu/upstream/sitesummary/-/compare/96a11ec2588146b8c614eac6cc100089ebaaf78f...6a9ea82e6ecebeceb9901efc50b6bc55451406ec
--
View it on GitLab: https://salsa.debian.org/debian-edu/upstream/sitesummary/-/compare/96a11ec2588146b8c614eac6cc100089ebaaf78f...6a9ea82e6ecebeceb9901efc50b6bc55451406ec
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-edu-commits/attachments/20230721/5f1efa2c/attachment-0001.htm>
More information about the debian-edu-commits
mailing list