From b207cd6b7f8982566054bb173a0f201d1e94765f Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Tue, 8 Oct 2024 12:14:44 +0200 Subject: [SS?S] Make slxadmin cron script triggered by systemd timer as well --- satellit_installer/static_files/slxadmin/etc/cron.d/slx-admin | 7 ------- .../static_files/slxadmin/etc/systemd/system/slx-cron.service | 7 +++++++ .../static_files/slxadmin/etc/systemd/system/slx-cron.timer | 10 ++++++++++ .../etc/systemd/system/timers.target.wants/slx-cron.timer | 1 + satellit_upgrader/updater.template.sh | 7 +++++-- 5 files changed, 23 insertions(+), 9 deletions(-) delete mode 100644 satellit_installer/static_files/slxadmin/etc/cron.d/slx-admin create mode 100644 satellit_installer/static_files/slxadmin/etc/systemd/system/slx-cron.service create mode 100644 satellit_installer/static_files/slxadmin/etc/systemd/system/slx-cron.timer create mode 120000 satellit_installer/static_files/slxadmin/etc/systemd/system/timers.target.wants/slx-cron.timer diff --git a/satellit_installer/static_files/slxadmin/etc/cron.d/slx-admin b/satellit_installer/static_files/slxadmin/etc/cron.d/slx-admin deleted file mode 100644 index 1e6cd11..0000000 --- a/satellit_installer/static_files/slxadmin/etc/cron.d/slx-admin +++ /dev/null @@ -1,7 +0,0 @@ -# Trigger taskmanager init on boot - -SHELL=/bin/sh -PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin - -# web-cron runs every 5 minutes -*/5 * * * * www-data /opt/openslx/slxadmin-cronscript diff --git a/satellit_installer/static_files/slxadmin/etc/systemd/system/slx-cron.service b/satellit_installer/static_files/slxadmin/etc/systemd/system/slx-cron.service new file mode 100644 index 0000000..3a29971 --- /dev/null +++ b/satellit_installer/static_files/slxadmin/etc/systemd/system/slx-cron.service @@ -0,0 +1,7 @@ +[Unit] +Description=SLX-Admin cron script +RefuseManualStart=yes + +[Service] +Type=oneshot +ExecStart=/opt/openslx/slxadmin-cronscript diff --git a/satellit_installer/static_files/slxadmin/etc/systemd/system/slx-cron.timer b/satellit_installer/static_files/slxadmin/etc/systemd/system/slx-cron.timer new file mode 100644 index 0000000..680c28e --- /dev/null +++ b/satellit_installer/static_files/slxadmin/etc/systemd/system/slx-cron.timer @@ -0,0 +1,10 @@ +[Unit] +Description=Trigger SLX-Admin Cron-Script + +[Timer] +OnCalendar=*:0/5 +AccuracySec=5 +RandomizedDelaySec=0 + +[Install] +WantedBy=timers.target diff --git a/satellit_installer/static_files/slxadmin/etc/systemd/system/timers.target.wants/slx-cron.timer b/satellit_installer/static_files/slxadmin/etc/systemd/system/timers.target.wants/slx-cron.timer new file mode 120000 index 0000000..9590a5c --- /dev/null +++ b/satellit_installer/static_files/slxadmin/etc/systemd/system/timers.target.wants/slx-cron.timer @@ -0,0 +1 @@ +../slx-cron.timer \ No newline at end of file diff --git a/satellit_upgrader/updater.template.sh b/satellit_upgrader/updater.template.sh index abd132a..aa7bf1b 100644 --- a/satellit_upgrader/updater.template.sh +++ b/satellit_upgrader/updater.template.sh @@ -523,8 +523,11 @@ if [ -n "$TGZ_SLXADMIN" ]; then # New scripts supplied diffcp "slxadmin" "/opt/openslx/slxadmin-cronscript" diffcp "slxadmin" "/opt/openslx/slxadmin-bootscript" - # New crontab supplied - diffcp "slxadmin" "/etc/cron.d/slx-admin" + # New crontab supplied - now as systemd timer + rm -f -- "/etc/cron.d/slx-admin" + diffcp "slxadmin" "/etc/systemd/system/slx-cron.service" + diffcp "slxadmin" "/etc/systemd/system/slx-cron.timer" + diffcp "slxadmin" "/etc/systemd/system/timers.target.wants/slx-cron.timer" # Service diffcp "slxadmin" "/etc/systemd/system/slxadmin-boot.service" ln -nfs "../slxadmin-boot.service" "/etc/systemd/system/multi-user.target.wants/slxadmin-boot.service" -- cgit v1.2.3-55-g7522