Configuration

Scheduled Tasks replaced your cron hacks

Scheduled Tasks replaced your cron hacks

Joomla has had a task scheduler since 4.1. Several jobs you do by hand, such as check-ins, session cleanup and update checks, are already plugins.

Look under System, Scheduled Tasks. It is a full scheduler: tasks, intervals, run history, and a log of what failed. What makes it useful is that Joomla ships a set of task plugins out of the box.

What is already there

  • Global check-in, which releases items left checked out by someone who closed a tab mid-edit. If your team keeps asking why an article is locked, schedule this daily and the question disappears.
  • Rotate logs, so the log folder does not quietly grow to a few gigabytes.
  • Session garbage collection, for sites that keep sessions in the database.
  • Delete action logs, which trims the user action log to a retention window you choose.
  • Update notification, which mails you when a Joomla update lands instead of you finding out three versions later.
  • Check files and site status, for taking a site offline or online on a schedule.
  • Requests, which calls a URL you specify. This is the escape hatch for anything the other plugins do not cover.

Making it actually run

A scheduler needs a trigger. Joomla gives you three, chosen in the Scheduled Tasks options.

Lazy scheduler hooks onto normal visitor traffic through the System - Schedule Runner plugin. No setup, but a task can only run when someone visits. On a quiet site your daily job becomes a weekly one.

Web cron gives you a URL with a key in it, which you hand to an external cron service. Useful on hosting without shell access. Treat the key like a password.

CLI is the one to use if you can:

php cli/joomla.php scheduler:run

Add that to a real cron job every few minutes and the scheduler behaves like a scheduler. To see what is defined and when it last ran:

php cli/joomla.php scheduler:list

One thing to watch

Tasks run as the scheduler, not as you. Anything that depends on a logged-in user will behave differently than it does when you click the button in the admin. Test a new task by running it once from the CLI and reading the output, rather than setting it to hourly and hoping.

Stuck on something else?

Doctor Joomla is a project of Cloudfaction, a Dutch agency building and maintaining Joomla sites since 1999. The articles are made with the help of AI, so tell us if something does not match your screen. Mail info@cloudfaction.nl if you want someone to look at yours.

Rather have someone look at it

Doctor Joomla is a Cloudfaction project.

A Dutch agency that has been building and running Joomla sites since 1999. If your site needs more than an article can fix, get in touch.