Joomla Scheduled Tasks: Cron, Web Cron or the Lazy Scheduler

Why a task can sit unrun with no error anywhere, the three ways to make Joomla run its tasks, a crontab line that works, and what to check when one does not.

Some of a website’s work should not happen while a visitor waits: sending queued emails, rotating log files, clearing old sessions, checking for a new version. Joomla has had a scheduler for this since version 4.1, under System → Manage → Scheduled Tasks, and extensions add jobs of their own to it.

The part people miss is what makes a task run, so this guide starts there. A Solidshop store is the worked example near the end; everything before it applies to any Joomla 5 or 6 site, checked against Joomla 6.2.0.

Three parts, and the one people miss

  • A task type is a job a plugin knows how to do, such as rotating logs or sending a queue of emails. It is offered only while its plugin is enabled.
  • A task is one configured job: a type, a schedule and a status.
  • A trigger is whatever makes Joomla look for due tasks and run them.

Creating a task only schedules it. If nothing triggers the scheduler, nothing runs and no error appears: the task simply stays due. The one sign is a warning on the Scheduled Tasks screen while an enabled task is overdue: “There is at least one due task which should have already run. Please make sure that at least one cron scheduler is enabled and running.” With tasks every minute it can flash up between runs. If it stays, no trigger is working.

What Joomla ships

Joomla 6 ships these task types:

  • Rotate Logs and Delete ActionLogs
  • Session Data Purge, for expired session data
  • Joomla! Update Notification, an email when a new version is out
  • Global Check-in, for items left checked out
  • Image Size Check, which resizes oversized images and overwrites the originals
  • GET Request, which calls a URL
  • Toggle Offline, Set Site Offline and Set Site Online
  • two privacy consent tasks, one to remind users to renew their consent and one to expire it

A fresh Joomla 6.2 install already has three enabled tasks: Rotate Logs every 30 days, and Session GC and Update Notification every 24 hours. They too wait for a trigger.

Creating a task

Click New on the Scheduled Tasks screen, pick a type from the list, and set the Execution Rule:

  • Interval, Minutes, Hours, Days or Months. The days and months rules also take an Execution Time, labelled UTC.
  • Cron Expression (Advanced): minutes, hours, days of the month, months and weekdays picked from lists, as in a crontab line.
  • Manual Execution: the task runs only when you start it.

On the Advanced tab, Priority decides which task goes first when several are due, Individual Task Logs gives the task a log file of its own, and Notifications chooses which user groups get an email when it succeeds, fails, crashes or is orphaned. Out of the box, everything except success is on, mailed to Super Users.

To try a task now, click Run Task in its row (the Run Manually column): a window reports the status, duration and output. The task’s Execution History tab keeps the last exit code, the last and next run, and how often it has run and failed.

What makes tasks run

The Lazy Scheduler and Web Cron are switched on and off under Scheduled Tasks → Options; the command line needs nothing.

The Lazy Scheduler

It is on by default, which is why tasks run on a new site with no setup. When Joomla renders a page, in the frontend or the administrator, and a task is due, it adds a small script. Once the page has loaded, the visitor’s browser sends a separate request that runs the next due task, and repeats it every Request Interval (seconds), 300 by default, while the page stays open.

So tasks run only when someone visits in a browser that runs JavaScript. On a quiet site they run late or not at all, and a crawler or uptime monitor that fetches only the HTML does not count. Each request runs one task, so several due tasks need several requests. Joomla’s own guide to choosing a scheduler says the Lazy Scheduler “does not guarantee that tasks run at their scheduled times”.

Web Cron

Web Cron is off by default. On the Web Cron tab of Options, set Web Cron to Yes and save: Joomla generates a secret key and shows the Webcron Link (Base). A cron job in your hosting control panel, or an external cron service, requests that link on a schedule, and each request runs the next due task; &id= plus a task’s ID runs that task instead. Copy the link from the screen. In full it has this shape, though search engine friendly URLs may shorten it:

https://www.example.com/index.php?option=com_ajax&plugin=RunSchedulerWebcron&group=system&format=json&hash=YOUR-KEY

Anyone with the link can start your tasks. If it gets out, Reset Access Key on the same tab issues a new one.

Cron on the server

A cron job on the site’s own server can skip the link and start the scheduler with Joomla’s command-line tool:

php /path/to/site/cli/joomla.php scheduler:run --all

--all runs every due task; without it, each run starts only the next one. --id=5 runs the enabled task with ID 5 now, due or not. scheduler:list prints each task with its state and next run, and marks an overdue one DUE!.

Which to choose

Use one trigger at a time, as Joomla’s guide advises:

  • Cron on the server when your host lets a cron job run a command. A web request can be cut off after a minute or two; a command runs as long as the task needs, with no link to keep secret.
  • Web Cron when the host’s cron can only call a URL, or there is no cron and you use an external service.
  • The Lazy Scheduler for development, or a site whose jobs can run late.

Once cron or Web Cron is in place, switch the Lazy Scheduler off. Its own description says “It is recommended to DISABLE the Lazy Scheduler, if triggering with native cron.” With both on, two schedulers start tasks, and they do not wait for each other in the same way: Web Cron and the Lazy Scheduler start no task while another is running, but the command line starts one anyway.

Setting up cron on a host

A crontab line has five time fields before the command: minute, hour, day of the month, month and day of the week. An asterisk means every value, so five of them mean every minute, as often as cron runs anything. A line starting with # is a comment.

# minute hour day-of-month month day-of-week command
* * * * * /usr/bin/php /path/to/site/cli/joomla.php scheduler:run --all >> /path/to/cron.log 2>&1
  • Use the full path to the PHP your site runs on. The php a cron job finds can be another version. Joomla 6 needs PHP 8.3 or later and Joomla 5 PHP 8.1 or later, according to the technical requirements for Joomla 6 and Joomla 5.
  • Run the job as the account that owns the site’s files. Tasks create cache and log files, and a file created by another account may not be writable by the website.
  • Keep the output for the first week. Cron mails it to the crontab’s owner unless it goes elsewhere, as in the line above. Once the job runs cleanly, > /dev/null 2>&1 discards it.

Control panels take the same command: cPanel under Cron Jobs, Plesk under Scheduled Tasks. Run it by hand once first; it lists each task it ran.

When tasks do not run

Nothing runs at all

No trigger is working: Last Run Date stays empty or old, the due-task warning stays, and scheduler:list shows DUE!. Check the plugin behind the type too. A task whose plugin is disabled is orphaned, cannot run, and is hidden from the list until its filter is set to Show Orphaned.

A task stays locked

Joomla locks a task while it runs, and the list marks it as running. If the process dies, the lock stays, and Web Cron and the Lazy Scheduler start no task at all until it is older than Task Timeout (seconds) in Options, 300 by default. To clear it at once, tick the task and choose Unlock from the actions.

A task fails

A warning icon next to the title reads Task failed with the exit code. Every run is logged to joomla_scheduler.php in the site’s log folder; with Individual Task Logs on, the task also writes a file of its own, which is easier to read.

The times look wrong

The list shows times in your own time zone, scheduler:list in UTC. The daily and monthly rules take their execution time in UTC, while a cron expression follows the site’s time zone in Global Configuration. Interval rules count from the run itself: after a late run, or a day with no trigger, the next one is due a full interval later, and missed runs are not made up.

The worked example: a Solidshop store

Solidshop queues its order emails rather than sending them while the customer waits, so a slow mail server cannot hold up checkout. The task type Solidshop: Process Email Queue comes from a core-package plugin: check that Task - Solidshop Email Queue is enabled under System → Manage → Plugins, then create the task with Interval, Minutes set to 1.

Each run sends up to 20 emails. A failed email is tried again on each following run, up to five attempts, so a mail server down for more than a few minutes uses them up. The email then waits on Solidshop’s Email Queue screen, where Retry gives it fresh attempts; sends and failures also show on the order’s timeline. Two runs at once never pick up the same email, and one claimed by a run that died is picked up again after ten minutes. With no trigger, emails simply wait.

The Downloadable add-on adds Solidshop: Expired Download Token Cleanup, which deletes download links past their expiry. They answer “link expired” either way, so the task only stops the table growing; daily is plenty.

The dashboard’s Store setup checklist has a Turn on order emails step that checks the plugin is on and an enabled task exists, which does not prove a trigger runs it. The Task Scheduler tab of Solidshop’s System page does: it shows each Solidshop task’s last and next run, and flags a missing, disabled, locked or failing task. The email queue setup guide goes through it step by step, and the Downloadable documentation covers the cleanup task.

Check your work

  1. Look at the list. Every enabled task has a recent Last Run Date, and no due-task warning stays on screen.
  2. Ask the command line. From the site root, no task should show DUE! for long.
    php cli/joomla.php scheduler:list
  3. Run one task by hand with Run Task and read the status and output.
  4. Test the job that matters. On a shop, place a test order: with the queue task running every minute, the confirmation should arrive within a couple of minutes.
  5. On a Solidshop store, open Solidshop → System → System and its Task Scheduler tab. It should say all Solidshop tasks are healthy, or list what to fix.

One trigger, then the tasks

A task describes the work; one trigger, preferably cron, makes it happen. Solidshop’s free core sends its order emails through the scheduler. Get it from the extensions page, or follow the email queue setup if your store is already running.