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
[–] 14 points 11 months ago* (1 child)

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.

  • source
  • hideshow 1 child comment