Besides the Lazy Scheduler and the Web Cron Scheduler described in How to Choose a Scheduler, Joomla can run its scheduled tasks from the command line. A cronjob on the server runs Joomla's own console application, cli/joomla.php, with the command scheduler:run. No browser, visitor or web request is involved.

For time-intensive tasks this is the best choice when your hosting lets you add cronjobs that run a command, not only cronjobs that call a URL:

  • No web time limits. A task runs as long as it needs. Over the web, the web server or the hosting may stop a request after a minute or two, which cuts long tasks short.
  • Precise timing, like Web Cron, with one-minute precision when the cronjob runs every minute.
  • No link to keep secret. Nothing has to be reachable from outside the server.

There is nothing to switch on in the Scheduled Tasks options: the command is always available.

It is a bit more work to setup, which defies more or less the goal of Joomla's Task Scheduler: to make scheduled tasks easily managable within the Admininistrator. Keep it up your sleeve as a trick to run time-intensive tasks.

Set up the cronjob

  1. In your hosting control panel, add a cronjob of the command type, to run every minute.
  2. Use this command, with the path to PHP and to your site on your server:
    /usr/bin/php /home/example/public_html/cli/joomla.php scheduler:run --all
    • Your host tells you the path to PHP. It must be a PHP version that your Joomla version supports (PHP 8.3 or later for Joomla 6).
    • --all runs every task that is due. Without it, each run starts only the next due task, so tasks wait for each other.
  3. Add > /dev/null 2>&1 at the end if you do not want the cron service to email you the output of every run.
  4. In System > Scheduled Tasks > Options, switch off the Lazy Scheduler and Web Cron, so only one scheduler starts your tasks.

Check that it works

Run the command once yourself, if your hosting offers a terminal (SSH):

php cli/joomla.php scheduler:run --all

Joomla lists each task it ran and finishes with Finished running N tasks. In System > Scheduled Tasks, the Last Run Date column shows when each task last ran.

Useful commands

Command What it does
php cli/joomla.php scheduler:list Lists the tasks with their ID, state and next run.
php cli/joomla.php scheduler:run --id=5 Runs the enabled task with ID 5 straight away, whether it is due or not.
php cli/joomla.php scheduler:run --all Runs all due tasks.
php cli/joomla.php scheduler:state Enables, disables or trashes a task.

All Joomla commands are described in Using the CLI.

Good to know

From the command line, Joomla runs a due task even while another task is still running. It can even start a task that is still running in an earlier process: scheduler:run does not check whether a task is locked. When a task takes longer than the interval of your cronjob, make sure two runs at the same time do no harm, or run that task less often. Web Cron and the Lazy Scheduler start no task while another task is running.