Error Codes Wiki

Systemd Timer Errors — Replacing Cron with Systemd Timers and Troubleshooting

Warningsystemd

About Systemd Timer Errors

Fix systemd timer errors including timers not triggering, incorrect scheduling, and transitioning from cron to systemd timers for better logging and control. This guide covers everything you need to know about this topic, including common causes, step-by-step solutions, and answers to frequently asked questions.

Here are the key things to understand: Systemd timers are the modern replacement for cron, offering better logging via journalctl. Each timer requires two unit files: a .timer file and a corresponding .service file. Timer types: OnCalendar (calendar-based) and OnBootSec/OnUnitActiveSec (relative to events). Timers are managed with systemctl: enable, start, status, list-timers. AccuracySec and RandomizedDelaySec prevent all timers from firing at the exact same time. Understanding these fundamentals will help you diagnose and resolve this issue more effectively.

The most common reasons this occurs include: Timer not enabled: created but not started with systemctl enable --now. Corresponding .service file missing or misconfigured. OnCalendar expression syntax incorrect (use systemd-analyze calendar to validate). Timer enabled but service unit fails silently — not checked via journalctl. AccuracySec too large causing timer to fire minutes after the intended time. Identifying the root cause is the first step toward finding the right solution.

To resolve this, follow these recommended steps: List active timers: systemctl list-timers --all. Create timer: /etc/systemd/system/mytask.timer with [Timer] section containing OnCalendar=. Create service: /etc/systemd/system/mytask.service with [Service] section containing ExecStart=. Validate calendar expression: systemd-analyze calendar 'Mon..Fri *-*-* 09:00:00'. Enable and start: systemctl daemon-reload && systemctl enable --now mytask.timer. Check logs: journalctl -u mytask.service to see output from the timer-triggered service. If these steps do not resolve the issue, consider consulting additional resources or a qualified professional.

This article is part of our Linux Error Codes collection on Error Codes Wiki. We provide comprehensive, up-to-date information to help you find solutions quickly.

Quick Answer

Should I use cron or systemd timers?

Systemd timers for new tasks: they have better logging (journalctl), dependency management, and resource control. Cron is simpler for quick one-off schedules. Most modern distros support both.

Overview

Fix systemd timer errors including timers not triggering, incorrect scheduling, and transitioning from cron to systemd timers for better logging and control.

Key Details

  • Systemd timers are the modern replacement for cron, offering better logging via journalctl
  • Each timer requires two unit files: a .timer file and a corresponding .service file
  • Timer types: OnCalendar (calendar-based) and OnBootSec/OnUnitActiveSec (relative to events)
  • Timers are managed with systemctl: enable, start, status, list-timers
  • AccuracySec and RandomizedDelaySec prevent all timers from firing at the exact same time

Common Causes

  • Timer not enabled: created but not started with systemctl enable --now
  • Corresponding .service file missing or misconfigured
  • OnCalendar expression syntax incorrect (use systemd-analyze calendar to validate)
  • Timer enabled but service unit fails silently — not checked via journalctl
  • AccuracySec too large causing timer to fire minutes after the intended time

Steps

  1. 1List active timers: systemctl list-timers --all
  2. 2Create timer: /etc/systemd/system/mytask.timer with [Timer] section containing OnCalendar=
  3. 3Create service: /etc/systemd/system/mytask.service with [Service] section containing ExecStart=
  4. 4Validate calendar expression: systemd-analyze calendar 'Mon..Fri *-*-* 09:00:00'
  5. 5Enable and start: systemctl daemon-reload && systemctl enable --now mytask.timer
  6. 6Check logs: journalctl -u mytask.service to see output from the timer-triggered service

Tags

systemd-timercron-replacementschedulingtimerautomation

Related Items

More in Systemd

Frequently Asked Questions

Systemd timers for new tasks: they have better logging (journalctl), dependency management, and resource control. Cron is simpler for quick one-off schedules. Most modern distros support both.