systemd Timer Generator
Build a .timer file with an OnCalendar schedule, a Persistent option and a link to its .service unit.
-
1Enter data
Enter content, paste text or load a file from disk. -
2Click the button
The tool will immediately process your data in the browser. -
3Get the result
Copy the finished text or save the file to your device.
return "Result ready in 0.1s";
}
Rate this tool:
Related tools
Other tools you may find usefulsystemd timer generator - a .timer file with an OnCalendar schedule
The systemd timer generator builds a ready .timer file: a [Timer] section with an OnCalendar schedule, an optional Persistent=true and RandomizedDelaySec, a link to the .service unit of the same name, and an [Install] section with WantedBy=timers.target. Type a name and schedule, then copy the result into /etc/systemd/system/.
A timer is only a schedule - the service does the work
The key point: the .timer file itself runs nothing. A timer is only a clock that activates a .service unit at the right moment. By default systemd looks for a service with the same name as the timer - if you have backup.timer, a backup.service must exist. The generator makes that link explicit with a Unit=name.service line. Without a .service file, systemctl enable --now backup.timer enables the clock, but at the scheduled time systemd finds no service and logs an error. You can start the service by hand (systemctl start backup.service) to test it first.
Anatomy of a .timer file
| Directive | Section | Role |
|---|---|---|
Description= | [Unit] | Readable label shown in systemctl list-timers |
OnCalendar= | [Timer] | Calendar-style schedule (hours, days, months) |
Persistent=true | [Timer] | Catches up on runs missed while the server was off |
RandomizedDelaySec= | [Timer] | Random start jitter - spreads load across many machines |
Unit= | [Timer] | The .service unit the timer should start |
WantedBy=timers.target | [Install] | The target that activates the timer on systemctl enable |
OnCalendar syntax - how to write a schedule
The OnCalendar value takes two forms. Named shortcuts: daily, hourly, weekly (Monday at midnight), monthly (first day of the month). The calendar form follows DayOfWeek Year-Month-Day Hour:Minute:Second, where * means "every". Examples: *-*-* 02:00:00 is every day at 02:00, Mon *-*-* 08:00:00 is Mondays at 08:00, and *-*-01 00:00:00 is the first day of each month. Check any expression without deploying by running systemd-analyze calendar "Mon *-*-* 08:00:00". Beyond OnCalendar there are relative triggers OnBootSec= and OnUnitActiveSec=; you add those by hand in the [Timer] section.
Persistent and RandomizedDelaySec - two options that matter
Persistent=true, a job scheduled while the machine was off is skipped. For backups and log rotation that is usually a bug - enable it and systemd runs the overdue job right after boot.RandomizedDelaySec adds a random delay within the given range (for example 5m, 1h). It helps when many servers fire the same job at once and you do not want them all hitting one resource at the same time.
How to use the generator
- Enter the timer name without an extension (for example
backup) - it producesbackup.timerand links tobackup.service. - Provide a description and an
OnCalendarschedule; if needed setRandomizedDelaySecand tickPersistent. - Click Generate timer and copy the result into
/etc/systemd/system/backup.timer. - Create the matching
backup.servicewith a[Service]section and anExecStart=- without it the timer has nothing to run. - Run
systemctl daemon-reload,systemctl enable --now backup.timer, and check the schedule withsystemctl list-timers.
systemd timers are the modern successor to cron. If you compare the two approaches, the crontab generator helps. A job that runs in a container gets its image from the Dockerfile generator, and local shortcuts belong in the Makefile generator. When tidying a repository the .dockerignore file generator is handy, and for publishing on Apache so is the .htaccess file generator.
A systemd timer or cron?
Cron is simpler in one line, but a systemd timer wins on reliability. Job logs go to journald (journalctl -u backup.service), so you see output and errors without your own redirection. A timer respects dependencies between units, resource limits from the [Service] section and can catch up on missed runs. Cron stays silent until you configure MAILTO.
What this tool does not do
The generator produces only the .timer file. You write the matching .service with ExecStart= separately - without it the timer is a clock with no alarm. It also does not handle OnBootSec/OnUnitActiveSec triggers or several OnCalendar entries; those you add by hand.
Frequently asked questions
Why does the timer not run even though it is enabled?
Most often the .service pair is missing or has a different name than the timer. A timer backup.timer looks for backup.service; if the service has another name, point to it with a Unit= line. Check the state with systemctl status backup.timer and the log with journalctl -u backup.service.
What does Persistent=true do?
If the machine was off or asleep at the scheduled time, a job with Persistent=true runs right after boot. Without it, a missed run is lost until the next scheduled time. For backups you usually want it enabled.
How do I check when the timer runs next?
The systemctl list-timers command shows every active timer with NEXT and LAST columns. You can verify the OnCalendar syntax alone, without enabling the timer, using systemd-analyze calendar "*-*-* 02:00:00".
Where do I save the .timer file and how do I enable it?
Units created by an administrator go in /etc/systemd/system/. After adding the file run systemctl daemon-reload so systemd loads it, then systemctl enable --now name.timer to enable it now and on every boot.