Paul Wise <p...@debian.org> writes:
> On Thu, Oct 18, 2018 at 5:24 AM Russ Allbery wrote:

>> Timer units are also a more complicated problem since they're not a
>> superset of cron behavior.  They do some things better than cron jobs;
>> they do other things much *worse* than cron jobs.  I have cron jobs
>> that I wanted to convert to timer units and discovered I couldn't
>> because timers simply wouldn't work for what I was trying to do.

> Could you give some examples of the issues you discovered with systemd
> timers?

> BTW, we have in systemd-cron a tool for generating systemd units from
> crontab/etc.

MAILTO was the main thing that I remember missing in terms of pure
functionality.

The other problem I can recall wasn't functionality, but was ease of use:
a timer unit can only trigger a service unit, and service units aren't
suitable for doing arbitrary shell scripting.  Here, this wasn't for
packaging but was instead as a local system administrator.  I have a lot
of cases where I drop a simple 20-line shell script into /etc/cron.daily
that has some logic intermixed with variables that list things like, say,
directories to back up to another host.  I looked at replacing that with a
timer unit, just as an experiment, but I would have had to write the timer
unit to control the timing, a separate exec unit that specifies what
command to run, and then put the shell script into yet a third file (with
no particularly obvious location for the local system administrator).
Since I don't like using /usr/local/bin for such things, I'd probably end
up extracting configuration from the script, sticking the script in a
local Debian package, and installing the configuration separately.  I now
have four different files just to replace a single file dropped into a
directory.

Admittedly, this was to replace something run from cron.daily, and maybe
the solution there (if one is considering a system that doesn't need a
separate cron daemon, which in theory should be possible if one wanted to
do it although not necessary of course) would be to have a single timer
unit that uses run-parts the way that cron runs cron.daily.  Timer units
were a closer match for cron.d, although I'm still missing MAILTO.

-- 
Russ Allbery (r...@debian.org)               <http://www.eyrie.org/~eagle/>

Reply via email to