Systemd timers Ubuntu scheduling is the modern replacement for many cron jobs on Ubuntu 24.04. Cron is simple and still useful, but it has real limits: a missed job is silently skipped, output goes to mail or nowhere, and a failed script simply runs again on the next schedule with no backoff. A systemd timer solves those problems by pairing a schedule with a normal service unit, so every run is logged by journald, can depend on the network or another service, and can be inspected with the same tools you already use for services.
This guide shows how to move a recurring backup, cleanup, or health-check job from cron to systemd timers Ubuntu step by step. You will create a service unit that does the work, a timer unit that defines the schedule, enable the timer, and verify the next run. The examples use Ubuntu 24.04 and systemd 255, but the same pattern works on Debian 12 and most current distributions.
Prerequisites for Systemd Timers Ubuntu
You need a server running Ubuntu 24.04 with sudo access and a basic understanding of the command line. No extra packages are required because systemd is already the init system. You should also know what your job actually does, including the user it should run as, the working directory, and any environment variables it needs. Moving a job without that information is how schedules break, so check the existing crontab first and copy the command exactly before you convert it.
Before you start, list existing timers and services so you can see the naming conventions already in use on your system. System timers such as apt-daily and logrotate already use this pattern, and studying one of them is a fast way to learn the format. Keep your own units in /etc/systemd/system/, not in /usr/lib/systemd/system/, because files in /etc are yours and will not be overwritten by package updates.
Step 1: Create the Service Unit for Systemd Timers Ubuntu
Start with the service, not the timer. A service unit describes exactly one run of your job. Create /etc/systemd/system/my-backup.service with a clear description, a type of oneshot for a job that runs and exits, and an ExecStart line that calls a script or a binary with an absolute path. Avoid relative paths and shell shortcuts, because systemd does not run your command through an interactive shell unless you explicitly ask for it.
[Unit]
Description=Daily application backup
After=network-online.target
Wants=network-online.target
[Service]
Type=oneshot
User=backup
WorkingDirectory=/opt/app
ExecStart=/usr/local/bin/app-backup.sh
Test the service before you schedule it. Run sudo systemctl start my-backup.service and then check the result with sudo systemctl status my-backup.service and sudo journalctl -u my-backup.service --since "10 minutes ago". If the service fails here, the timer will only repeat the failure on schedule, so fix permissions, paths, and environment variables now. This test-first habit is the single biggest advantage over cron, where a bad job can fail quietly for weeks.
Step 2: Create the Timer Unit and Schedule It
Next, create a timer unit with exactly the same base name, /etc/systemd/system/my-backup.timer. The timer does not run anything itself; it only activates the service of the same name at the scheduled time. Use OnCalendar for calendar schedules, OnBootSec or OnUnitActiveSec for relative schedules, and Persistent=true when a missed run should catch up after the machine was off.
[Unit]
Description=Run daily application backup
[Timer]
OnCalendar=daily
Persistent=true
Unit=my-backup.service
[Install]
WantedBy=timers.target
Common OnCalendar values include daily, weekly, hourly, Mon *-*-* 03:00:00 for every Monday at 3 a.m., and *-*-* 02:30:00 for every day at 2:30 a.m. You can verify a calendar expression before you rely on it with systemd-analyze calendar "Mon *-*-* 03:00:00", which prints the next matching times. That check catches typos that cron would also catch only after a missed run.
Reload systemd, enable the timer, and start it:
sudo systemctl daemon-reload
sudo systemctl enable --now my-backup.timer
sudo systemctl list-timers --all | grep my-backup

The list-timers output shows the next run, the last run, and the unit that will be activated. If the next run column is empty or shows a surprising date, re-check your OnCalendar expression. Enabling the timer is what makes it survive a reboot; starting it only affects the current boot, so always use enable --now for a permanent schedule.
Step 3: Use Randomized Delays and Accuracy Settings
On a fleet of servers, running the same job at exactly the same second can overload a shared database or storage system. Add RandomizedDelaySec=15min to spread runs over a window, or AccuracySec=1min to let systemd group timer events and reduce wake-ups. These two settings are a practical reason to prefer systemd timers Ubuntu over cron for backup and reporting jobs, because cron has no built-in way to randomize a schedule across machines.
[Timer]
OnCalendar=daily
Persistent=true
RandomizedDelaySec=10min
AccuracySec=1min
For jobs that should run a fixed interval after the previous run finishes, use OnUnitActiveSec=6h instead of a calendar expression. That pattern is useful for polling or sync jobs where overlapping runs would be harmful. Combine it with a service of type oneshot and, if the job must never overlap itself, a lock inside the script or a separate locking mechanism, because systemd timers will start the service again even if the previous run is still going unless you prevent it.
Troubleshooting Systemd Timers Ubuntu
If a timer never fires, check three things in order. First, confirm the timer is enabled and active with systemctl status my-backup.timer. Second, confirm the service name matches: a timer named my-backup.timer activates my-backup.service by default, and a different Unit= line overrides that. Third, run systemctl daemon-reload after every edit, because systemd reads unit files only on reload or reboot.
If the timer fires but the job fails, read the journal, not the mailbox. The command journalctl -u my-backup.service -b shows this boot’s runs, and journalctl -u my-backup.service --since yesterday shows recent history. Common causes are a missing absolute path, a wrong user, an unset environment variable, and a script that relies on a shell alias. For environment variables, set them explicitly in the service unit with Environment= lines or an EnvironmentFile= pointing at a restricted file.
For more background on the cron syntax you may be replacing, see our guide to cron and crontab for beginners, and if a service fails to start at all, our systemd service troubleshooting guide covers the same journal workflow. The official reference is the systemd.timer manual page.
Conclusion
Systemd timers Ubuntu gives you scheduled jobs with real logs, dependencies, catch-up behaviour, and testable service units. The conversion is small: one service unit, one timer unit, a reload, and an enable. Keep cron for genuinely trivial one-liners if you like, but move anything important — backups, cleanups, certificate renewals, and health checks — to a timer, and verify the next run with list-timers before you delete the old crontab entry.