Skip to main content

Scheduled tasks

Scheduled tasks in Joomla are automated processes that run at preset times. These tasks help with routine maintenance tasks such as deleting old log files, sending notifications, or modifying data. Scheduled tasks are available from Joomla 4.1 and up, and in this article I'll show you how to set them up and what tasks are available.

How to set scheduled tasks?

- Go to your Joomla backend.
- Navigate to System > Scheduled Tasks.

geplande taken 01

There you will see an overview of all tasks set on your website. Depending on your Joomla version and/or history, these may be different tasks for each website. With a new installation of Joomla 5, these tasks are active.

geplande taken overizcht

In principle you do not need to modify these tasks, but we open the Update notification plugin, by clicking on the title, to see how the plugin looks like.

geplande taken detail

At the top you will see the buttons to save or close the task.

The Title is an administrative title, so it is only used so you can quickly find the right task.

In the first tab you see the basic fields, these fields are the same for all task plugins.

Execution rule: Select here the interval, when a plugin should be executed. You can choose from Minutes, Hours, Days, Months, Cron expression or manual

Interval in ... : You can enter a number, e.g. 3.

The task is then executed as above settings. For example: Months and 3, then the task is executed 1x per quarter.

Under the basic fields you will find the task fields. In this case you can fill in an email address, but that is not relevant for every task. So these fields are different for each task.

geplande taken geavanceerd

The advanced tab is divided into 3 sections.

Priority: Here you can define the order of tasks to be executed at the same time. Generally you don't need this for the average website.

Logging: When a task fails, it is useful to know why this happened. With an individual task log, you can create a separate file for this purpose.

Notifications: Send a notification when a task succeeded, failed, caused errors or refers to parts that are no longer used on the website.

geplande taken historie

In the 3rd tab "Execution history" you can see what the status of the task plugin is. When was this task last executed, when is the next time it will be executed. How many times the task was executed and how many times it went wrong.

Adding new tasks

In the task overview you have the New button at the top

geplande taken alle taken

Image size check: This task checks images in a specific folder, resizes the image when it is larger than allowed. It is a useful plugin, when the administrator or visitors themselves put images on the website without regard to optimization.Note: The original file is overwritten!

Remove action logs: When you keep track of what actions are performed on the website, the action log can grow quickly. You probably don't want to keep all the information and throw it away after 3 months, for example. For that, this plugin is suitable.

General check-in (since Joomla 5): Do you know the locks for an item. Often someone has locked this item incorrectly and then it remains locked. With this plugin you can reactivate the checked out items after a certain time.

Get Request: Create a Get request for a URL that you want to run at a certain time.

Expire Privacy Permission: If you are using the Joomla privacy suite, then users need to give permission for information sharing. This plugin manages consent and sends reminders when consent expires.

Rotate Logs: This plugin's main function is to automatically rotate log files, which means moving or deleting older log files to save space and optimize your website's performance.

Clear Session Data: The "Clear Session Data" feature in Joomla is designed to delete temporary session data stored by the website. Session data is used to store information about users during their visit to the website, such as logged-in status, preferences and other temporary data.

Offline switching: The website is switched offline or online each time the plugin is processed. (To be honest, I can't think of a use case why you would want to do this, do you know? Let me know via the contact form;) )

Putting the site online / offline: If you want to put the website offline at a specific time (for example, when it should not be accessible on Sundays for religious reasons) you can do that with these plugins. Or should the website be launched at a specific time and you cannot do this manually because you are not available. That too is possible with this plugin.

Joomla Update notification: This plugin in Joomla is designed to notify you via email of available updates for your Joomla installation.

How are scheduled tasks triggered?

You can find these settings in the task overview by the "options" button at the top right.

By default, a task is triggered by an activity on the website, i.e. when a visitor opens the website. This is called Lazy task scheduler.

geplande taken luie taakplanner

In many cases, this is fine. But if you don't have a visitor at that time, the task will not be executed either. For example: You want to make a backup of your Web site every night at 2 a.m.. This task is not performed until the first visitor opens the Web site in the morning. You don't want that to happen.

You can also have the tasks triggered by a cron job.

Enable the web cron and you will now see a link.

You can use this link in your hosting party's system which handles cronjobs.

geplande taken web cron

If you cannot set up a cronjob on your hosting package or you do not know what the correct settings are then I recommend using https://cron-job.org.

Setting up cronjobs via cron-job.org

geplande taken cron job website

Through the website cron-job.org you can run simple cronjobs through a free account.

After you create a free account, you can create cronjobs.

Enter a title.
Paste the url from your Joomla website.
Enter when the cronjob should be run.
And save it.

This way the cronjob is always executed exactly at your desired time.

geplande taken cron job

Exit codes / Error codes for scheduled tasks

-2 : INVALID_EXIT = Used when a routine returns an invalid (non-integer) exit code.
-1 : NO_EXIT = Used when a routine does not return an exit code.
1 : RUNNING = Used when the routine is just starting. This is not intended as an exit code.
2: NO_LOCK = Used when a routine cannot obtain a pseudo-lock.
3: NO_RUN = Used when unable to execute the task.
4: NO_RELEASE = Used when unable to release the lock or update the record.
5: KNOCKOUT = Used when a routine is "disabled" by an exception.
123: WILL_RESUME = Used when a task is to be resumed. Use this for long-running tasks to split them into smaller batches. When the last batch is done, return Status::OK.
124: TIMEOUT = Used when a task has a timeout.
125: NO_TASK = Used when a task does not exist.
127: NO_ROUTINE = Used when a routine is missing.
0: OK = This is the exit code on success.

Scheduled task plugins.

You can find several scheduled task plugins, some developers have created a task plugin to complement their extension. Below I will discuss my favorite plugins:

Akeeba Admin Tools PRO:

https://www.akeeba.com/products/admin-tools.html
PHP File Change scanner
: This plugin scans all php files for changes and suspicious code
Blocked Requests Log cleanup: Clears the blocked action log
Session table repair & optimize: Repairs and optimizes the #__session database table
Clean up session metadata: Removes obsolete sessions in the #__session database table
Cache clean-up: Clean up cache
Delete inactive users: Delete users based on your criteria (never logged in or account not activated for a certain period of time)
Clean up the temporary directory: Delete all files in the tmp directory
Auto-import configuration: Import the configuration from a central file

Akeeba Backup PRO:

https://www.akeeba.com/products/akeeba-backup.html
Take a Backup: Make a backup via a selected profile
CLI-only Backup: A backup will only run if triggered via CLI

SchuWeb Sitemap:

https://extensions.joomla.org/extension/schuweb-sitemap/
Update sitemap XML: This sitemap extension creates a /sitemap.xml file. The task plugin ensures that the file is updated with all pages, images and news items.

DPMedia:

https://joomla.digital-peak.com/documentation/dpmedia/joomla-plugins/task
Media Sync: Sync remote files with local files
Sync Local media files: Sync local files with cloud services

DPCases:

https://joomla.digital-peak.com/documentation/dpcases/plugins/task
Send notification to author when a case is about to be closed

DPCalendar:

https://joomla.digital-peak.com/documentation/dpcalendar/joomla-plugins/task
Sync Events: Synchronize the website with external calendars
Send ticket certificates: Send a certificate when the event has ended
Booking deletions: Delete bookings with certain criteria
Event deletions: Delete events with certain criteria
Event reminders: Send reminders

HikaShop:

Mass Action: Perform a bulk action(https://www.hikashop.com/marketplace/product/284-task-massaction.html)
Task Report: Create a report and send it as an email attachment(https://www.hikashop.com/marketplace/product/283-task-report.html)

Zero24 ExtensionUpdates:

https://extensions.joomla.org/extension/extensionupdates/
Checks for extension updates and sends an email when available.

Zero24 TaskCheckin:

https://extensions.joomla.org/extension/taskcheckin/
This plugin checks all items in (only for Joomla 4, as there is a core plugin in Joomla 5 that does the same thing)

Zero24 ReviewContentNotification:

https://extensions.joomla.org/extension/reviewcontentnotification/
This Joomla plugin checks whether an existing content item has not been modified for an given time to inform the author and ask him to confirm the content of the article.

 

TLWebdesign Auto Delete Files:

https://github.com/TLWebdesignNL/Auto-Delete-Files-Task-Scheduler-Plugin
This plugin checks files for last edit (PHP's filemtime function) and deletes files older than the set time.

Kick Manage Article:

https://github.com/Kicktemp/plg_task_kickmanagearticle
Move an article to another category when it is older than X days

CCC Timewarp:

https://coolcat-campus.com/en/extensions/joomla-task-scheduler-plugin-ccc-timewarp

Adjust an article (category, special, status, permissions) when it is older than X days, this plugin also works with custom fields data.

Reset Hits:

https://github.com/woluweb/plg_task_resethits

Reset article views to 0, useful to use when you want to show a list of this month's popular articles.

Delete Trashed:

https://www.alikonweb.it/extensions/task-plugin-delete-trashed

Deletes items from the trash (not just articles, but also categories, modules, references, etc.).

Force password reset:

https://myjoomlacoder.com/joomla-task-plugins/joomla-force-password-reset-task-plugin
Causes users of selected groups to reset their passwords periodically. You can set different periods for different user groups. When the task is executed, the user is forced to reset their password after the next login

End Users Sessions:

https://myjoomlacoder.com/joomla-task-plugins/joomla-end-users-sessions-task-plugin
Users are forced to re-login if Remember Me is not enabled. You can select whether to apply it for both the front and backend or just the front end.

Manage Inactive Users:

https://myjoomlacoder.com/joomla-task-plugins/joomla-manage-inactive-users-task-plugin
helps you manage inactive users. By inactive users we mean: Users who never logged in after registration. Users who have not logged in for a certain period of time. Users who have not activated their account. You can choose how to deal with them by blocking or deleting them after a certain period of time.

FT Auto Update:

https://extensions.joomla.org/extension/tf-auto-update/

This plugin allows you to update or delete data in the database.

Migrate user profiles to custom fields:

https://kicktemp.shop/produkte/kickprofiletocustomfield

Move an old Joomla user profile to custom fields. (These custom fields are easier to use in e.g. Yootheme elements)

This article was updated on: 26 December 2024

Want to know more?

Wondering if I'm the right partner for your project? Then take a look at my portfolio, see what my clients say or contact me directly.


Related articles

About Jeroen

I have been working with the Joomla! CMS since 2006. Besides building and maintaining Joomla! websites and webshops, I am also familiar with search engine optimization (SEO), Joomla hosting and developing templates and extensions. Furthermore, I am a frequent visitor and speaker at JoomlaDays and various Joomla user groups.

I am committed to the Joomla! community as a member of the Extensions Directory team and the organization of Joomla user group Breda and JoomlaDagen Netherlands. In short: Are you looking for a Joomla Specialist, you should contact me!