Systemd timers vs. cron for job scheduling

Ralf Mardorf kde.lists at yahoo.com
Fri May 8 19:28:26 UTC 2020


I don't know anything about systemd timers, but Deep Thought googled:

"Benefits

The main benefits of using timers come from each job having its own
systemd service. Some of these benefits are:

    Jobs can be easily started independently of their timers. This
    simplifies debugging.
    Each job can be configured to run in a specific environment (see
    systemd.exec(5)).
    Jobs can be attached to cgroups.
    Jobs can be set up to depend on other systemd units.
    Jobs are logged in the systemd journal for easy debugging.

Caveats

Some things that are easy to do with cron are difficult to do with
timer units alone:

    Creation: to set up a timed job with systemd you need to create two
    files and run systemctl commands, compared to adding a single line
    to a crontab.
    Emails: there is no built-in equivalent to cron's MAILTO for
    sending emails on job failure. See the next section for an example
    of setting up a similar functionality using OnFailure=."
- https://wiki.archlinux.org/index.php/Systemd/Timers#Benefits




More information about the ubuntu-users mailing list