From 95138ccb1638399b38373f9df2e7533337ba45fc Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Sun, 10 Sep 2023 13:25:50 +0200 Subject: [PATCH] pkgadmin: Use systemd.timer instead of cron Now that many workstations are switched off during nighttime, we have the problems that these don't pull new packages. Use systemd.timer and utilize `Persistent=true` to catch up on missed events at boot time. Also use `RandomizedDelaySec=2 hours` to avoid overloading the fileserver or the network when a new big package is going to be pulled by all systems. --- install.sh | 3 ++- pkgadmin/crond-pkgadmin-update | 2 -- pkgadmin/pkgadmin-update.service | 2 ++ pkgadmin/pkgadmin-update.timer | 7 +++++++ 4 files changed, 11 insertions(+), 3 deletions(-) delete mode 100644 pkgadmin/crond-pkgadmin-update create mode 100644 pkgadmin/pkgadmin-update.service create mode 100644 pkgadmin/pkgadmin-update.timer diff --git a/install.sh b/install.sh index 96cba83f..a1671c6c 100755 --- a/install.sh +++ b/install.sh @@ -152,7 +152,8 @@ install_exec prun/ptype "$DESTDIR$usr_bindir/pt install_exec prun/pman "$DESTDIR$usr_bindir/pman" install_exec put_websafe/put_websafe "$DESTDIR$usrlocal_bindir/put_websafe" install_exec pkgadmin/pkgadmin "$DESTDIR$usr_sbindir/pkgadmin" -install_cron pkgadmin/crond-pkgadmin-update "$DESTDIR$crond_dir/pkgadmin-update" +install_data pkgadmin/pkgadmin-update.service "$DESTDIR$systemdunitdir/pkgadmin-update.service" +install_data pkgadmin/pkgadmin-update.timer "$DESTDIR$systemdunitdir/pkgadmin-update.timer" install_exec mxraid/mxraid "$DESTDIR$usr_sbindir/mxraid" install_exec mxraid/mxraid_assemble "$DESTDIR$usr_sbindir/mxraid_assemble" install_data mxraid/mxraid.service "$DESTDIR$systemdunitdir/mxraid.service" diff --git a/pkgadmin/crond-pkgadmin-update b/pkgadmin/crond-pkgadmin-update deleted file mode 100644 index 0731fe88..00000000 --- a/pkgadmin/crond-pkgadmin-update +++ /dev/null @@ -1,2 +0,0 @@ -RANDOM_DELAY=240 -0 2 * * * root . ./.bashrc; pkgadmin update > /dev/null 2>&1 diff --git a/pkgadmin/pkgadmin-update.service b/pkgadmin/pkgadmin-update.service new file mode 100644 index 00000000..dac867db --- /dev/null +++ b/pkgadmin/pkgadmin-update.service @@ -0,0 +1,2 @@ +[Service] +ExecStart=pkgadmin update diff --git a/pkgadmin/pkgadmin-update.timer b/pkgadmin/pkgadmin-update.timer new file mode 100644 index 00000000..ce2be3f3 --- /dev/null +++ b/pkgadmin/pkgadmin-update.timer @@ -0,0 +1,7 @@ +[Timer] +OnCalendar=2:00 +RandomizedDelaySec=2 hours +Persistent=true + +[Install] +WantedBy=timers.target