[debian-edu-commits] [Git][debian-edu/debian-edu-config][mr/cron-2-systemd-timers] Convert CRON configuration to systemd timers.
Mike Gabriel (@sunweaver)
gitlab at salsa.debian.org
Mon Aug 7 17:35:34 BST 2023
Mike Gabriel pushed to branch mr/cron-2-systemd-timers at Debian Edu / debian-edu-config
Commits:
7ef89078 by Mike Gabriel at 2023-08-07T18:35:18+02:00
Convert CRON configuration to systemd timers.
- - - - -
15 changed files:
- Makefile
- debian/debian-edu-config.cron.daily
- debian/debian-edu-config.cron.hourly
- + debian/debian-edu-config.debian-edu-cups-queue-autoflush.service
- + debian/debian-edu-config.debian-edu-cups-queue-autoflush.timer
- + debian/debian-edu-config.debian-edu-cups-queue-autoreenable.service
- + debian/debian-edu-config.debian-edu-cups-queue-autoreenable.timer
- + debian/debian-edu-config.debian-edu-fsautoresize.service
- + debian/debian-edu-config.debian-edu-fsautoresize.timer
- + debian/debian-edu-config.debian-edu-update-netblock.service
- + debian/debian-edu-config.debian-edu-update-netblock.timer
- debian/rules
- + sbin/debian-edu-cups-queue-autoflush-for-netgroup-hosts
- + sbin/debian-edu-cups-queue-autoreenable-for-netgroup-hosts
- + sbin/debian-edu-fsautoresize-for-netgroup-hosts
Changes:
=====================================
Makefile
=====================================
@@ -8,7 +8,11 @@ PROGS = \
debian-edu-copy-pki \
$(NULL)
-SPROGS = debian-edu-fsautoresize \
+SPROGS = \
+ debian-edu-cups-queue-autoflush-for-netgroup-hosts \
+ debian-edu-cups-queue-autoreenable-for-netgroup-hosts \
+ debian-edu-fsautoresize \
+ debian-edu-fsautoresize-for-netgroup-hosts \
debian-edu-ltsp-chroot \
debian-edu-ltsp-install \
debian-edu-ltsp-initrd \
=====================================
debian/debian-edu-config.cron.daily
=====================================
@@ -3,12 +3,5 @@
PATH=/bin:/usr/bin:/sbin:/usr/sbin
export PATH
-[ -x /usr/bin/innetgr ] || exit 0
-
-# Automatically flush print queues every night if the
-# host is a member of the cups-queue-autoflush-hosts netgroup.
-for hostname in "$(uname -n)" "$(hostname -s)" ; do
- if innetgr -h $hostname cups-queue-autoflush-hosts ; then
- /usr/share/debian-edu-config/tools/cups-queue-autoflush
- fi
-done
+# regularly run CUPS Queue autoflush if configured via netgroups
+debian-edu-cups-queue-autoflush-for-netgroup-hosts
=====================================
debian/debian-edu-config.cron.hourly
=====================================
@@ -3,21 +3,8 @@
PATH=/bin:/usr/bin:/sbin:/usr/sbin
export PATH
-[ -x /usr/bin/innetgr ] || exit 0
+# regularly run fsautoresize if configured via netgroups
+debian-edu-fsautoresize-for-netgroup-hosts
-for hostname in "$(uname -n)" "$(hostname -s)" ; do
-
- # Automatically extend full LVM volumes if the host is a member of
- # the fsautoresize-hosts netgroup.
- if [ -x /usr/sbin/debian-edu-fsautoresize ] &&
- innetgr -h $hostname fsautoresize-hosts ; then
- debian-edu-fsautoresize -n
- fi
-
- # Automatically restart disabled print queues every hour if the
- # host is a member of the cups-queue-autoreenable-hosts netgroup.
- if [ -x /usr/share/debian-edu-config/tools/cups-queue-autoreenable ] &&
- innetgr -h $hostname cups-queue-autoreenable-hosts ; then
- /usr/share/debian-edu-config/tools/cups-queue-autoreenable
- fi
-done
+# regularly run CUPS Queue autoreenable if configured via netgroups
+debian-edu-cups-queue-autoreenable-for-netgroup-hosts
=====================================
debian/debian-edu-config.debian-edu-cups-queue-autoflush.service
=====================================
@@ -0,0 +1,6 @@
+[Unit]
+Description=Auto-flush CUPS queues on hosts configured via the cups-queue-autoflush-hosts netgroup.
+
+[Service]
+Type=oneshot
+ExecStart=/usr/sbin/debian-edu-cups-queue-autoflush-for-netgroup-hosts
=====================================
debian/debian-edu-config.debian-edu-cups-queue-autoflush.timer
=====================================
@@ -0,0 +1,9 @@
+[Unit]
+Description=Run debian-edu-cups-queue-autoflush.service every day.
+
+[Timer]
+OnBootSec=15min
+OnUnitActiveSec=1d
+
+[Install]
+WantedBy=timers.target
=====================================
debian/debian-edu-config.debian-edu-cups-queue-autoreenable.service
=====================================
@@ -0,0 +1,6 @@
+[Unit]
+Description=Auto-reenable CUPS queues on hosts configured via the cups-queue-autoreenable-hosts netgroup.
+
+[Service]
+Type=oneshot
+ExecStart=/usr/sbin/debian-edu-cups-queue-autoreenable-for-netgroup-hosts
=====================================
debian/debian-edu-config.debian-edu-cups-queue-autoreenable.timer
=====================================
@@ -0,0 +1,9 @@
+[Unit]
+Description=Run debian-edu-cups-queue-autoreenable.service every hour.
+
+[Timer]
+OnBootSec=15min
+OnUnitActiveSec=1h
+
+[Install]
+WantedBy=timers.target
=====================================
debian/debian-edu-config.debian-edu-fsautoresize.service
=====================================
@@ -0,0 +1,6 @@
+[Unit]
+Description=Run fsautoresize regularly on hosts configured via the fsautoresize-hosts netgroup.
+
+[Service]
+Type=oneshot
+ExecStart=/usr/sbin/debian-edu-fsautoresize-for-netgroup-hosts
=====================================
debian/debian-edu-config.debian-edu-fsautoresize.timer
=====================================
@@ -0,0 +1,9 @@
+[Unit]
+Description=Run debian-edu-fsautoresize.service every hour.
+
+[Timer]
+OnBootSec=15min
+OnUnitActiveSec=1h
+
+[Install]
+WantedBy=timers.target
=====================================
debian/debian-edu-config.debian-edu-update-netblock.service
=====================================
@@ -0,0 +1,6 @@
+[Unit]
+Description=Update netblock according to netblock-hosts netgroup configuration.
+
+[Service]
+Type=oneshot
+ExecStart="/usr/sbin/debian-edu-update-netblock auto"
=====================================
debian/debian-edu-config.debian-edu-update-netblock.timer
=====================================
@@ -0,0 +1,9 @@
+[Unit]
+Description=Run debian-edu-update-netblock.service every 5 minutes
+
+[Timer]
+OnBootSec=15min
+OnUnitActiveSec=5min
+
+[Install]
+WantedBy=timers.target
=====================================
debian/rules
=====================================
@@ -21,6 +21,10 @@ override_dh_installsystemd:
dh_installsystemd --no-start --name enable-nat
dh_installsystemd --no-start --name fetch-rootca-cert
dh_installsystemd --no-start --name firefox-ldapconf
+ dh_installsystemd --no-start --name debian-edu-fsautoresize
+ dh_installsystemd --no-start --name debian-edu-update-netblock
+ dh_installsystemd --no-start --name debian-edu-cups-queue-autoflush
+ dh_installsystemd --no-start --name debian-edu-cups-queue-autoreenable
override_dh_installman:
dh_installman
=====================================
sbin/debian-edu-cups-queue-autoflush-for-netgroup-hosts
=====================================
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+[ -x /usr/bin/innetgr ] || exit 0
+
+# Automatically flush print queues every night if the
+# host is a member of the cups-queue-autoflush-hosts netgroup.
+for hostname in "$(uname -n)" "$(hostname -s)" ; do
+ if innetgr -h $hostname cups-queue-autoflush-hosts ; then
+ /usr/share/debian-edu-config/tools/cups-queue-autoflush
+ fi
+done
=====================================
sbin/debian-edu-cups-queue-autoreenable-for-netgroup-hosts
=====================================
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+[ -x /usr/bin/innetgr ] || exit 0
+
+for hostname in "$(uname -n)" "$(hostname -s)" ; do
+
+ # Automatically extend full LVM volumes if the host is a member of
+ # the fsautoresize-hosts netgroup.
+ if [ -x /usr/sbin/debian-edu-fsautoresize ] &&
+ innetgr -h $hostname fsautoresize-hosts ; then
+ debian-edu-fsautoresize -n
+ fi
+
+ # Automatically restart disabled print queues every hour if the
+ # host is a member of the cups-queue-autoreenable-hosts netgroup.
+ if [ -x /usr/share/debian-edu-config/tools/cups-queue-autoreenable ] &&
+ innetgr -h $hostname cups-queue-autoreenable-hosts ; then
+ /usr/share/debian-edu-config/tools/cups-queue-autoreenable
+ fi
+done
=====================================
sbin/debian-edu-fsautoresize-for-netgroup-hosts
=====================================
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+[ -x /usr/bin/innetgr ] || exit 0
+
+for hostname in "$(uname -n)" "$(hostname -s)" ; do
+
+ # Automatically extend full LVM volumes if the host is a member of
+ # the fsautoresize-hosts netgroup.
+ if [ -x /usr/sbin/debian-edu-fsautoresize ] &&
+ innetgr -h $hostname fsautoresize-hosts ; then
+ debian-edu-fsautoresize -n
+ fi
+
+done
View it on GitLab: https://salsa.debian.org/debian-edu/debian-edu-config/-/commit/7ef890781204291bd3c7c205b1227267f0ce3f78
--
View it on GitLab: https://salsa.debian.org/debian-edu/debian-edu-config/-/commit/7ef890781204291bd3c7c205b1227267f0ce3f78
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/20230807/adab2599/attachment-0001.htm>
More information about the debian-edu-commits
mailing list