Scheduling a periodic job on Joomla: which trigger to use and how to set it up
Scheduling a periodic job on Joomla comes down to three decisions: the task, its timing rule, and what wakes Joomla up. Joomla's built-in Scheduled Tasks component stores the first two. Out of the box, the third is the Lazy Scheduler, which only runs tasks when someone visits the site. For dependable timing, add a real trigger: a server cron that calls Joomla's CLI, or the Web Cron link called by an online cron service.
Everything below was checked against the Joomla 6.2 source code and also applies to Joomla 5. Where older versions behave differently, the text says so.
Key takeaways
- A task is a saved timing rule plus parameters. It runs only when a trigger calls the scheduler.
- There are three triggers: a server cron running
php cli/joomla.php scheduler:run --all(the production choice), the Web Cron link (for hosts without cron), and the Lazy Scheduler (on by default, driven by visitors). - Keep
--allin the cron command. Without it, each call runs only one due task, which is also all the Web Cron link and the Lazy Scheduler ever do. - Check the result in Execution History (Joomla 5.3 and later) or the task's Last Exit Code: 0 means success.
How periodic jobs work in Joomla: the cron job vs the scheduler
A cron job is a command your server runs at times you name. Joomla's task scheduler decides which of your tasks are due and runs them. They are not alternatives: the cron job presses the button, and the scheduler does the thinking.
The scheduler is the core Scheduled Tasks component (com_scheduler), added in Joomla 4.1 in February 2022. Joomla 5.0 moved log rotation, session clean-up and update e-mails into scheduled tasks, and Joomla 5.3 added an Execution History view.
Every periodic job in Joomla is built from three parts:
- The task. The record you create in the backend: a title, an execution rule, task parameters, a status, and later the last exit code. This is your configuration.
- The routine. The actual work, provided by an enabled task plugin. You don't write it; you pick it from a list when you create the task. If the plugin is disabled, the task becomes orphaned, which is one of the most common causes of a broken schedule.
- The trigger. What makes Joomla look at the queue and run whatever is due. This is the part most guides leave vague, and the part that decides whether your job runs on time.
Keep that split in mind and troubleshooting gets much faster: a task that never runs is usually a trigger problem, and a task that fails is usually a routine or plugin problem.
What you need before you start
- Administrator access to the Joomla backend, with permission to manage Scheduled Tasks and plugins.
- An enabled task plugin for the routine you want. All core task plugins are enabled on a new installation; on an upgraded or long-lived site, check under System → Manage → Plugins with the type filter set to task.
- To know whether your host offers cron jobs (cPanel, Plesk or SSH). That decides the trigger in step 3.
- A test window. Set the first run a few minutes ahead, confirm it worked, then move the rule to its real time.
Step 1: Create the task in Joomla Scheduled Tasks
Creating the task takes about a minute. The timing rule and the trigger are separate steps, so keep the rule loose at first.
- In the administrator backend, go to System → Manage → Scheduled Tasks. This is the task list. Its toolbar has New, Actions, Execution History and Options.
- Click New. Joomla first shows the list of task types: pick the routine you want. This is the work, not the schedule.
- Give the task a title you will recognise in a log six months from now. "Nightly image size check" beats "Task 1".
- Choose the Execution Rule (next step).
- Fill in the Task Parameters. They differ per routine: GET Request asks for a URL, a timeout and an optional authorization header; Delete ActionLogs asks how many days of logs to keep.
- Leave the status on Enabled and click Save & Close.
- In the task list, click the task's Run Task button (in the Run Manually column). Joomla runs it at once and shows the status, duration and output. This proves the routine works before any schedule is involved.
Where routines come from: core task plugins, extensions and web services
Joomla core ships these routines. Each comes from a task plugin whose name starts with plg_task_, and all of them are enabled on a new Joomla 5 or 6 installation.
| Routine | Plugin | Since | What it does |
|---|---|---|---|
| GET Request | plg_task_requests | 4.1 | Calls a URL, with a custom timeout and an optional authorization header |
| Image Size Check | plg_task_checkfiles | 4.1 | Resizes images larger than a set size. It overwrites the originals |
| Set Site Offline, Set Site Online, Toggle Offline | plg_task_sitestatus | 4.1 | Switches the site's offline mode, for example around a maintenance window |
| Delete ActionLogs | plg_task_deleteactionlogs | 5.0 | Deletes User Actions Log entries older than a number of days |
| Global Check-in | plg_task_globalcheckin | 5.0 | Checks in items that users left checked out |
| Expiration of privacy consents | plg_task_privacyconsent | 5.0 | Expires old privacy consents and sends renewal reminders |
| Rotate Logs | plg_task_rotatelogs | 5.0 | Rotates Joomla's own log files so they don't grow forever |
| Session Data Purge | plg_task_sessiongc | 5.0 | Purges expired session data |
| Joomla! Update Notification | plg_task_updatenotification | 5.0 | E-mails Super Users when a new Joomla version is available |
Backup, security and shop extensions often add their own task types, and a custom task plugin can register routines exactly as the core ones do. The core GET Request routine is the bridge to everything else: it calls any URL on a schedule, so you can drive an API, a webhook or another application's sync endpoint without writing PHP.
Step 2: Choose the timing rule
The timing rule is the Execution Rule field on the task edit screen. Joomla offers six types:
| Execution Rule | Example | Use it when |
|---|---|---|
| Interval, Minutes | Every 15 minutes | The job just needs to happen often |
| Interval, Hours | Every 6 hours | The job just needs to happen regularly |
| Interval, Days | Every 1 day, Execution Time 03:00 | Daily or weekly clean-ups and reports. The time is in UTC |
| Interval, Months | Every 1 month, Execution Day 1, 06:00 | Monthly jobs. The time is in UTC |
| Cron Expression (Advanced) | Minutes 0, Hours 3, Mon–Fri | It must run at set times or on set weekdays |
| Manual Execution | Run Task button only | You want to start it yourself |
Joomla doesn't let you type a cron expression. It shows five lists (Minutes, Hours, Days of Month, Months and Days of Week), each needing at least one value, and selecting all of a list's values means "every", like *. Minutes 0, Hours 3 and everything selected in the other three lists is 0 3 * * *. If you think in crontab syntax, check the expression with the cron analyzer first, then copy its values into the lists; the every-hour cron expression is a good one to start from.
Three behaviours are worth knowing before you rely on the schedule:
- The next run is calculated after each run. A task that missed its window runs once when the scheduler next wakes up, then gets a new next run date. Missed runs don't pile up into a backlog.
- Intervals count from the last run, not from a clock. An "every 6 hours" task that ran 40 minutes late stays 40 minutes late from then on.
- Time zones differ by rule type. The Execution Time of the Days and Months rules is always UTC, as its label says. A cron expression is read in the site's time zone (Global Configuration → Server → Website Time Zone) from Joomla 5.2 and late 4.4 releases; older versions read it as UTC. If a nightly job runs at the wrong hour, check this first, and remember that daylight saving time moves local times twice a year.
Watch out
If you need a report at 06:00 every Monday, use Cron Expression (Advanced) with Days of Week set to Monday, not "Interval, Days: 7". A 7-day interval keeps whatever weekday the task last ran on.
Step 3: Pick the trigger
This decides whether the whole setup works. The three triggers differ far more in reliability than in effort.
| Trigger | Reliability | Tasks per call | Needs host cron | Best fit |
|---|---|---|---|---|
| Server cron (CLI) | Highest: runs on a clock, with or without visitors | All due tasks with --all | Yes | Production sites and anything timing-critical |
| Web Cron link | Good, if an external service calls it on time | One | No | Hosts without cron jobs |
| Lazy Scheduler | Low: depends on visitors and caching | One | No | Sites where a late run really is fine |
| Run Task button | Manual only | The one you click | No | Testing a routine before it goes live |
Option A: run Joomla's CLI from a server cron
Choose this if your host gives you cron jobs. Joomla ships a command-line entry point at cli/joomla.php, and its scheduler:run command runs the scheduler:
php /home/example/public_html/cli/joomla.php scheduler:run --all
The flags matter:
--allruns every task that is due, highest priority first. Without it, each call runs only one due task, and the rest wait for the next call.--id=12runs task 12 right now, even if it isn't due. Use it for testing from the command line.- When nothing is due, the command prints
No tasks due!and exits with code 125. That is normal, not an error.
Two related commands help while you set things up: scheduler:list shows every task with its next run, and scheduler:state enables, disables or trashes a task.
- Find the PHP CLI binary. Over SSH,
which phpreturns a path such as/usr/bin/php. Without SSH, the control panel's PHP settings page usually shows the CLI path for each version. - Find the absolute path to your site root. Run
pwdin the Joomla directory, or read it from your hosting file manager. On shared hosting it often looks like/home/username/public_html. - Run the command by hand first and read the output. If a task is due, it runs now and you see the result immediately.
- Add the cron entry. In cPanel use Cron Jobs, in Plesk Scheduled Tasks, and over SSH
crontab -e. One line covers every task on the site:
*/5 * * * * /usr/bin/php /home/example/public_html/cli/joomla.php scheduler:run --all >> /home/example/joomla-scheduler.log 2>&1
Every five minutes suits most sites: tasks start within five minutes of their time, and a call with nothing due costs almost nothing. Use * * * * * if you have minute-level intervals. The redirect keeps a second history next to Joomla's own and stops cron e-mailing you every "No tasks due!".
Then open Options in the Scheduled Tasks toolbar and set Lazy Scheduler to Disabled. Joomla's own help text recommends this when you trigger with cron, and it keeps visitor-triggered runs out of your timing.
Tip
Use absolute paths for both PHP and cli/joomla.php: cron starts in a minimal environment. If the command works by hand but not from cron, the PHP binary is the usual culprit, because hosts with several PHP versions often give cron an older one than your site uses.
Option B: the Web Cron link
When the host gives you no cron at all, Joomla can expose an HTTP endpoint instead. It is off by default.
- Open System → Manage → Scheduled Tasks → Options and go to the Web Cron tab.
- Set Web Cron to Enabled and save. Joomla generates the access key on save.
- Reopen the tab and copy the Webcron Link (Base). It looks like this:
https://example.com/index.php?option=com_ajax&plugin=RunSchedulerWebcron&group=system&format=json&hash=YOUR_KEY
- Each request runs at most one due task, highest priority first. With several tasks due at once, they run on successive requests.
- Add
&id=12to run task 12 right away, whether or not it is due. - Treat the link as a password. Anyone who has it can start your tasks, including heavy ones, on demand. If it leaks, use Reset Access Key on the same tab.
Something has to call the link on a schedule: an online cron service. Five minutes is a good default. If many tasks fall due at the same time, call it every minute so they don't queue for long. The online cron job services compared roundup covers the options, and Cronit is one of them:
- Create a recurring job in Cronit.
- Method GET, URL: your Webcron Link (Base).
- Schedule
*/5 * * * *, or* * * * *if tasks queue up.
Every call then appears in the job's execution log with its status, so a site that stops answering is visible without logging in to Joomla. Compare the number of calls with your plan's monthly allowance on the pricing section.
Option C: the Lazy Scheduler
The Lazy Scheduler is Joomla's built-in fallback, and it is on by default. When a page is rendered while a task is due, Joomla adds a small script to it. The visitor's browser then calls the scheduler in the background, at most once per Request Interval (300 seconds by default, under the Lazy Scheduler tab in Options), and each call runs one due task.
That has failure modes you should plan for:
- A quiet site runs late. If nobody visits between 2 a.m. and 8 a.m., nothing runs between 2 a.m. and 8 a.m.
- Caching gets in the way. The script is only added to pages rendered while a task is due. Pages served from a page cache, a CDN or a reverse proxy usually don't carry it.
- Bots don't count. The call comes from JavaScript in a real browser, so search engine crawlers and uptime checks don't trigger anything.
That is fine for tasks where late doesn't matter, such as purging expired sessions. For anything people see, such as a stock sync or a reminder e-mail, use a real trigger.
Which trigger fits your site?
One question decides most cases: can you add a cron job on your host?
Whichever trigger you pick, turn failure notifications on (next section), so a schedule that stops is something you hear about.
Confirm the first run worked
From Joomla 5.3, the Execution History button in the Scheduled Tasks toolbar opens the run history. Each row shows the task, its type, the run date, the duration, the exit code and the next run. On older versions, open the task: its Execution History fields show the last exit code, last and next run, and how many times it ran and failed. Joomla also writes every run to joomla_scheduler.php in the site's log folder (administrator/logs by default).
| Exit code | Meaning | What to do |
|---|---|---|
| 0 | Success | Nothing. Check the next run date and walk away |
| 123 | Will resume: the routine did part of the work and continues on the next run | Keep the trigger firing. This is normal for batched work |
| 5 | Failed: the routine reported an error | Read the task's output or the log file for the reason |
| 124 | Timed out: GET Request got no answer within its timeout | Check the remote URL, or raise the timeout in the task parameters |
| 127 | Orphaned: the routine was not found, because its task plugin is disabled or removed | Enable or reinstall the plugin, then run the task again |
| 125 | CLI only: no task was due, or no task has that id | Nothing, unless you expected a task to be due |
Each task also has a Notifications tab. Failure, crash and orphaned-task e-mails are on by default; success e-mails are off. They go to the user groups you choose, or else to Super Users with Receive System Emails switched on. Make sure your site can actually send mail, or a failure stays silent.
When a task does not run: the five usual causes
Five problems explain almost every broken schedule. Work through them in order.
- No trigger is firing. Joomla warns at the top of the task list: "There is at least one due task which should have already run." Check the cron entry, the Web Cron service, or whether the Lazy Scheduler was disabled with nothing to replace it.
- Exit code 127. The task plugin was disabled, often during an update or a plugin clean-up, so the task points at a routine that no longer exists. The task list's filter can show only orphaned tasks. Enable the plugin and the task resumes.
- The cron command lacks
--all. Each call then runs only one due task. With several tasks due at once, the low-priority ones run late, or never on a busy site. - The same task started twice. Joomla locks a task while it runs, but treats the lock as stale once the Task Timeout passes (Options, default 300 seconds). A task that runs longer than that can be started again by the next trigger. Set the timeout comfortably above the task's real duration.
- A task is stuck after a crash. If PHP died mid-run, the lock stays until the Task Timeout expires, so the next run is late. To release it now, select the task and choose Actions → Unlock.
When several tasks fall due in the same window, Priority (High, Normal or Low) decides the order, then the task that has waited longest goes first. A heavy high-priority job delays everything behind it. If the problem is on the cron side rather than in Joomla, the cron job not running checklist covers it.
Joomla 3 and older sites: no task scheduler
Joomla 3 and Joomla 4.0 have no Scheduled Tasks component. Periodic work on those sites comes from a server cron calling a PHP script, from an extension with its own scheduler, or from an online cron service calling a URL that the site or an extension exposes. The real fix is upgrading: Joomla 3 no longer receives security updates.
Best practices and a go-live checklist
- Stagger start times. Two heavy tasks at 03:00 compete for the same CPU. Put the second one at 03:30.
- Run heavy work off-peak, especially on shared hosting, where CPU is shared and long processes get killed.
- Watch the outcome, not the setup. A schedule that broke three weeks ago looks the same as one that works, unless something is watching. Our guide to monitoring cron jobs covers the alerting side.
Go-live checklist
- The task plugin that provides the routine is enabled.
- A trigger is set up and you have seen it fire at least once.
- The cron command includes
--all, or the Web Cron service calls often enough for your busiest hour. - The Lazy Scheduler is disabled if you use a real trigger.
- The execution rule produces the run times you expect, in the time zone you expect.
- The Task Timeout is above the task's real duration.
- The task ran with the Run Task button, and again through the real trigger.
- Exit code 0 shows in Execution History or as the task's Last Exit Code.
- Failure notifications are on, and you have received a test e-mail from the site.
FAQ
- What is the difference between a cron job and Joomla's scheduler?
- A cron job is a command the server runs at fixed times. Joomla's scheduler, the Scheduled Tasks component, knows your tasks and runs the ones that are due. The cron job only wakes it up, so you need both.
- Do I need shell access to schedule a Joomla task?
- No. Most control panels have a Cron Jobs screen that accepts the same command as SSH. If your host has no cron at all, enable the Web Cron link and have an online cron service call it.
- Can one cron entry run all my Joomla tasks?
- Yes, if it includes
--all:php cli/joomla.php scheduler:run --allruns every task that is due. Without--all, each call runs only one due task, so on a busy site the others wait for the next call. - How do I make a Joomla task run every hour?
- Set the Execution Rule to Interval, Hours with a value of 1. That counts an hour from each run. To run exactly on the hour instead, use Cron Expression (Advanced) with Minutes set to 0 and every value selected in the other four lists, which is the same as
0 * * * *. - What does exit code 127 mean in Joomla Scheduled Tasks?
- The task is orphaned: its routine was not found, because the task plugin that provides it is disabled or uninstalled. Enable or reinstall the plugin and the next run should return 0.