Ubuntu Task Scheduler Planner
“Should this job go in cron, a systemd timer, anacron, or inside the
application itself?” is the first question every recurring task asks on
Ubuntu — and the answer depends on your machine and
your requirements, not on habit. Describe the task in panel 1 (what it
runs, how often, whether the machine sleeps), tick the operational
requirements in panel 2, and this planner scores all four schedulers against
that profile: cron, systemd timers, anacron and application-level schedulers
such as APScheduler or node-cron. It then hands you a verdict with the reasons,
a side-by-side fit table, and ready-to-paste configuration for every
option — .service/.timer unit files, the
crontab line, the anacrontab entry or the code snippet — plus a combined
install script you can run on the box. Everything is computed in this tab: your
command lines and paths never leave the page.
100% private. The scoring, the comparison table and every generated config file are produced with JavaScript in this browser tab. Your commands — which often name internal paths, hosts and credentials — never leave the page; there is no server-side calculation and nothing to send.
1. Describe the task
A preset fills every field for a common scenario — pick one and edit it, or start from scratch.
2. Requirements
Tick everything that is true of this job. Each tick re-scores the four schedulers and rewrites the generated configs.
How each scheduler fits your requirements
Generated configuration
Checks on this plan
How to use it
Start from a preset if one matches — the seven cover the recurring-task scenarios that come up most often in production: the sleeping-laptop backup, the always-on health check, the weekly report, the monthly renewal, the post-reboot initialiser, the high-frequency worker and the resident app. Then edit whatever does not fit: the command path, the run time, the user. The frequency control adapts to itself — a daily job asks for a time, an interval job asks for minutes or hours, a boot job asks for nothing.
Panel 2 is where the decision actually happens. Each ticked requirement
changes the scoring: a machine that sleeps penalises cron and in-app
schedulers (both can miss the slot entirely) and rewards systemd timers with
Persistent=true and anacron, which both replay missed work when
power returns. The results panel then shows the verdict with its reasons, a
fit table with one icon per requirement per scheduler, and a tab for every
option — recommended first. Copy any tab’s config, download the
install script for the winner, or copy the share link to hand the whole plan
(inputs included) to a colleague. The page re-plans live as you change
anything, so you can watch the verdict flip while you argue with your own
requirements.
Worked example: the sleeping-laptop backup
Pick the “Daily backup on a laptop that sleeps” preset. It fills in
a one-shot job, /usr/local/bin/backup.sh, daily at 02:30, running
as root, with three requirements ticked: the machine may be off at the
scheduled time, it is a laptop that sleeps regularly, and logs must be
findable later.
The planner scores the four options against that profile:
- systemd timer wins. A timer with
Persistent=truerecords the last time it fired; boot the laptop on Wednesday and it runs the Tuesday backup immediately, then returns to its 02:30 rhythm. The generated pair is aType=oneshotservice plus a timer withOnCalendar=*-*-* 02:30:00, and the log isjournalctl -u backup— no redirects, no mail spool. - cron loses on the catch-up requirement. The line would be the familiar
30 2 * * * /usr/local/bin/backup.sh, but if the laptop was asleep at 02:30 the slot is simply gone — cron has no memory of it. The fit table marks this with a red cross and the findings panel says so in plain English. - anacron is the classic answer for exactly this shape of problem (daily granularity, run whenever the machine is next on), but on Ubuntu 24.04 and later it is not installed by default, so the planner notes the extra
apt install anacronstep. - The in-app scheduler scores worst: a scheduler library inside a process only fires while that process is running, and nothing on a sleeping laptop keeps a backup daemon alive at 02:30.
The install script for the winning option writes both unit files, runs
systemctl daemon-reload and enables the timer with one command.
After that, systemctl list-timers backup shows the next fire time
and journalctl -u backup --since today is the log — which is
exactly the “logs matter” requirement, satisfied by construction rather
than by remembering to redirect stdout.
How it works
The scoring is deliberately transparent: each scheduler starts from a base score (systemd 34, cron 30, anacron 22, in-app 16 — reflecting that on a modern Ubuntu box systemd is the most capable of the four, cron the most familiar, and anacron a legacy fallback), and every ticked requirement adds or subtracts points per scheduler with a written reason. The fit table shows the same data as icons — green for a genuine strength, amber for “works with a workaround”, red for a structural mismatch — and hovering any icon gives you the exact reason, so you can disagree with the model by un-ticking a requirement and watching the table re-score.
The configuration generation is plain text templating, not magic. Frequencies
map onto each scheduler’s native syntax: daily 02:30 becomes
OnCalendar=*-*-* 02:30:00 for systemd and 30 2 * * * for cron;
Monday 09:00 becomes Mon *-*-* 09:00:00 and 0 9 * * 1; the 1st of the
month becomes *-*-01 03:00:00 and 0 3 1 * *; an every-15-minutes job
becomes OnUnitActiveSec=15min for systemd and */15 * * * * for cron — and if you ever need
sub-minute steps, only the systemd timer can express them. Tick “must not overlap” and the
cron line is wrapped in flock -n; tick “depends on other services” and the
systemd unit gains After=network-online.target plus a matching
Wants=. The install script wraps the chosen option in quoted heredocs so
nothing is shell-expanded before it lands on disk.
Cron vs systemd timers vs anacron vs in-app schedulers
cron is the oldest scheduler on the box and still the right default for
a simple, short, always-on job: one line in crontab -e, per-user tabs, no
unit files to understand. Its structural limits are also well known — one
minute is its finest granularity, its environment is a minimal PATH, it cannot
wait for dependencies, it has no catch-up for missed slots, and a % in the
command line is silently treated as a newline.
systemd timers are what Ubuntu uses for its own periodic work, and they fix
most of cron’s gaps: OnCalendar speaks full calendar syntax (including
ordinals like “first Tuesday”), Persistent=true backfills a missed run after
sleep or reboot, After=/Wants= order the job against the network and mounts,
OnUnitActiveSec goes below one minute, and every run is journaled. The costs are
two small files instead of one line, and the fact that a timer will not start a
unit that is already active — usually what you want, but worth knowing.
anacron exists for machines that are off most of the time: an entry says “daily”, and it runs once whenever the system is next on, regardless of when that is. It is the honest answer for a weekly laptop sync. On Ubuntu 24.04 and later it is no longer installed by default, which is a signal about where the platform considers the problem solved.
In-app schedulers (APScheduler, node-cron, Celery beat) are the right tool when the schedule belongs to the application’s domain: per-user jobs, schedules that change at runtime, logic that needs the app’s database. The trade-off is total — the scheduler lives and dies with the process, so a reboot or a crash silently stops every job until something restarts the app. If you choose this route, the planner still generates a systemd unit to keep the app itself resident.
Common mistakes this planner catches
- Cron on a machine that sleeps. The classic silent data loss: the backup “runs daily at 02:30” and simply does not, on every night the lid was closed. The catch-up requirement flips the verdict to
Persistent=true(or anacron) and the findings panel names the risk explicitly. - cron’s minimal PATH. A crontab line with a bare command name fails at 02:30 with “command not found” because cron does not read your profile. The generated cron config always sets
PATHandSHELL, and the command field asks for an absolute path. - The percent trap. In a crontab line,
%means newline and everything after it becomes stdin. If your command contains one, the findings panel tells you to quote it as\%before the config is ever pasted. - Treating a long-running process as a scheduled task. A worker that should stay up is not a timer job — it is a plain
.servicewithRestart=on-failure. Picking “long-running process” changes the verdict to exactly that and links out to the Systemd Service Generator for the full unit options. - An in-app scheduler on a machine that reboots. The library is only as alive as its process. The planner flags this combination and includes the boot-start unit so the app (and therefore its schedule) comes back with the box.
- Expecting overlapping runs from a systemd timer. Timers skip a trigger while the service is already active. If you genuinely need concurrent executions that is a different design — and the no-overlap requirement inverts the warning into a feature.
- anacron on a modern release. It is not installed by default on Ubuntu 24.04+, so any plan that lands on anacron carries the
apt install anacronstep in its config rather than assuming the file exists.
Related tools
Suggested
Luke Keam | techgeek.biz