[debian-edu-commits] [Git][debian-edu/debian-edu-config][master] 2 commits: Convert CRON configuration to systemd timers.
Guido Berhörster (@gber)
gitlab at salsa.debian.org
Thu Aug 10 10:23:23 BST 2023
Guido Berhörster pushed to branch master at Debian Edu / debian-edu-config
Commits:
5da55e56 by Mike Gabriel at 2023-08-10T09:19:04+00:00
Convert CRON configuration to systemd timers.
- - - - -
9ec5fe82 by Mike Gabriel at 2023-08-10T09:19:04+00:00
sbin/*-for-netgroup-hosts: Some noop + white-spacing beautifications.
- - - - -
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,7 @@
PATH=/bin:/usr/bin:/sbin:/usr/sbin
export PATH
-[ -x /usr/bin/innetgr ] || exit 0
+[ -d /run/systemd/system ] && 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,10 @@
PATH=/bin:/usr/bin:/sbin:/usr/sbin
export PATH
-[ -x /usr/bin/innetgr ] || exit 0
+[ -d /run/systemd/system ] && exit 0
-for hostname in "$(uname -n)" "$(hostname -s)" ; do
+# regularly run fsautoresize if configured via netgroups
+debian-edu-fsautoresize-for-netgroup-hosts
- # 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,13 @@
+#!/bin/sh
+
+[ -x /usr/bin/innetgr ] || exit 0
+
+for hostname in "$(uname -n)" "$(hostname -s)" ; do
+
+ # Automatically flush print queues every night if the
+ # host is a member of the cups-queue-autoflush-hosts netgroup.
+ if innetgr -h $hostname cups-queue-autoflush-hosts ; then
+ exec /usr/share/debian-edu-config/tools/cups-queue-autoflush
+ fi
+
+done
=====================================
sbin/debian-edu-cups-queue-autoreenable-for-netgroup-hosts
=====================================
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+[ -x /usr/bin/innetgr ] || exit 0
+
+for hostname in "$(uname -n)" "$(hostname -s)" ; do
+
+ # 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
+ exec /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
+ exec debian-edu-fsautoresize -n
+ fi
+
+done
View it on GitLab: https://salsa.debian.org/debian-edu/debian-edu-config/-/compare/385f9033782f95ad32ac2eba90bab7031379eb90...9ec5fe82ad2b5c65ac0284713cbbbb4cf8d25a92
--
View it on GitLab: https://salsa.debian.org/debian-edu/debian-edu-config/-/compare/385f9033782f95ad32ac2eba90bab7031379eb90...9ec5fe82ad2b5c65ac0284713cbbbb4cf8d25a92
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/20230810/c575f2ca/attachment-0001.htm>
More information about the debian-edu-commits
mailing list