Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.bugs.dist > #1125624

Bug#923014: Add systemd unit - allow usage without cron installed

From Paul Wise <pabs@debian.org>
Newsgroups linux.debian.bugs.dist
Subject Bug#923014: Add systemd unit - allow usage without cron installed
Date 2022-11-20 01:20 +0100
Message-ID <FtGdY-4VNF-9@gated-at.bofh.it> (permalink)
References (4 earlier) <FsC2J-4f0P-1@gated-at.bofh.it> <xut3b-OQ-5@gated-at.bofh.it> <Ftba9-4C1i-1@gated-at.bofh.it> <xut3b-OQ-5@gated-at.bofh.it> <Ftba9-4C1i-1@gated-at.bofh.it>
Organization Debian

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On Fri, 2022-11-18 at 16:06 +0100, Bill Allombert wrote:

> But then the user would not be able to configure it anymore,
> so I do not see the upside.

I just discovered an alternative that preserves the current location
and the conffile status of the cron.daily script. The script stays the
same, except it exits under systemd when the first argument isn't a
option indicating that the script should continue under systemd.
The systemd service then passes that option as the only parameter.

An example from the exim4-base package:

   $ head -n8 /etc/cron.daily/exim4-base
   #!/bin/sh
   
   EX4SYSTEMDTIMER=$1
   
   # skip in favour of systemd timer if called from cron.daily
   if [ -d /run/systemd/system ] && [ "$EX4SYSTEMDTIMER" != "systemd-timer" ]; then
               exit 0
   fi
   
   $ systemctl cat exim4-base.service exim4-base.timer
   # /lib/systemd/system/exim4-base.service
   [Unit]
   Description=exim4-base housekeeping
   Documentation=man:exim4(8)
   ConditionACPower=true
   Before=logrotate.service
   
   [Service]
   Type=oneshot
   ExecStart=/etc/cron.daily/exim4-base systemd-timer
   
   # performance options
   Nice=19
   IOSchedulingClass=best-effort
   IOSchedulingPriority=7
   
   # /lib/systemd/system/exim4-base.timer
   [Unit]
   Description=Daily exim4-base housekeeping
   Documentation=man:exim4(8)
   Before=logrotate.timer
   
   [Timer]
   OnCalendar=daily
   AccuracySec=12h
   Persistent=true
   
   [Install]
   WantedBy=timers.target

-- 
bye,
pabs

https://wiki.debian.org/PaulWise

Back to linux.debian.bugs.dist | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Bug#923014: Add systemd unit - allow usage without cron installed Bill Allombert <ballombe@debian.org> - 2022-11-16 19:30 +0100
  Bug#923014: Add systemd unit - allow usage without cron installed Paul Wise <pabs@debian.org> - 2022-11-17 02:40 +0100
    Bug#923014: Add systemd unit - allow usage without cron installed Alexandre Detiste <alexandre.detiste@gmail.com> - 2022-11-17 05:30 +0100
    Bug#923014: Add systemd unit - allow usage without cron installed Bill Allombert <ballombe@debian.org> - 2022-11-18 16:10 +0100
      Bug#923014: Add systemd unit - allow usage without cron installed Paul Wise <pabs@debian.org> - 2022-11-19 10:30 +0100
      Bug#923014: Add systemd unit - allow usage without cron installed Paul Wise <pabs@debian.org> - 2022-11-20 01:20 +0100

csiph-web