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

Linux

10709 readers
203 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 1 month ago* (last edited 1 month 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 1 month ago* (last edited 1 month 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.

load more comments (1 replies)