[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Q: systemd-timer vs cron



On 2022-03-12 Hideki Yamane <henrich@iijmio-mail.jp> wrote:
>  Is there any suggestion or guideline for pacakges that contain
>  both systemd-timer unit setting and cronjob? Don't they conflict
>  or not

Hello,

You want to skip running the cronjob on systems with systemd as init
systems. e.g. exim's daily cronjob works like this:
1. the systemd unit runs /etc/cron.daily/exim4-base with argument
   systemd-timer.
2. /etc/cron.daily/exim4-base checks for a systemd setup by testing 
   existence of /run/systemd/system. On a systemd setup the script
   exits immediately when executed from cron (i.e. $1!=systemd-timer).

If the cron script itself was trivial I would avoid the ugliness of invoking
/etc/cron.d* from systemd. ;-)

cu Andreas
-- 
`What a good friend you are to him, Dr. Maturin. His other friends are
so grateful to you.'
`I sew his ears on from time to time, sure'


Reply to: