this post was submitted on 21 Nov 2025
44 points (97.8% liked)

Linux

10229 readers
710 users here now

A community for everything relating to the GNU/Linux operating system (except the memes!)

Also, check out:

Original icon base courtesy of lewing@isc.tamu.edu and The GIMP

founded 2 years ago
MODERATORS
 

Just learned of timers the other day, but I'm a cron guy, anybody out there using timers? Anything I'm missing out on?

you are viewing a single comment's thread
view the rest of the comments
[–] e8d79@discuss.tchncs.de 16 points 3 days ago* (last edited 3 days ago) (2 children)

My number one reason for using systemd timers is just that I find it more readable than cron. Usually I want to run things daily, weekly or monthlyand systemd timers make that very easy.

Here is an example:

backup.timer

[Unit]
Description=Run backup database daily

[Timer]
OnCalendar=daily
RandomizedDelaySec=10

[Install]
WantedBy=timers.target

backup.service

[Unit]
Description=Backup database

[Service]
Type=oneshot
ExecStart=/bin/bash /path/to/backupscript.sh

Another great feature is that the output of the script is logged to journald which is very convenient when you are troubleshooting why your backup failed last night.

[–] nous@programming.dev 6 points 2 days ago* (last edited 2 days ago)

You can also easily see when the job last ran, if it was successful and when it will next run. As well as just trigger the service if you want it to run now.

[–] Successful_Try543@feddit.org 6 points 3 days ago

Usually I want to run things daily, weekly or monthlyand systemd timers make that very easy.

While crontab also has keywords for @daily, @weekly and @monthly, the automatic logging of systemd is useful and your example shows that it additionally allows to specify delays. I don't know how anacron handles the latter.