Improve Your Productivity With the Joomla 4 Task Scheduler

Hey Joomla enthusiasts! It’s time to walk you through one of the new features of Joomla that is sure to add up to your convenience. As you know Joomla’s latest update brings you a number of features along with the inclusion of Task Scheduler. Previously, Joomla didn’t come with any built-in cron scheduler. So the good news is even if your website host doesn’t allow cron jobs, Joomla has got your back!

This new addition will surely help you avoid repetitive tasks that you wouldn’t want to go back and repeat again and again. Whether you wish to process email queues in newsletter systems, synchronize e-commerce orders with a delivery platform, or clean up cache, the task scheduler is there to take care of it all. 

In this article, we will look at how you can assess and set up some of the built-in Task Schedulers of Joomla 4.1.

A Brief Overview of Each Default Task

Task Scheduler allows the website owner to create web-based cron jobs from an environment that you’re already familiar with, and comfortable working within. So let’s dive in deeper to explore the default task schedulers that come with Joomla 4.1. 

Among the 9 default or pre-installed tasks, only some are useful, and others are for demo ideas. Here is a quick overview of each of the default tasks:

  • Image Size Check: Resizes images from your given directory after a certain interval of time.
  • Demo Task – Sleep: Do nothing for a certain interval of time.
  • Stress Memory: Decide a task behavior when you run out of PHP memory limit
  • Stress Memory, Override Limit: Decide a task behavior when you run out of system memory limit
  • Resumable Task: This is useful whenever you have long-running tasks to avoid hitting a memory or timeout limit on your server.
  • GET Request: Make a custom timeout for GET Requests to a server.
  • Toggle Offline: Set the site’s status to online or offline on each run.
  • Set Site Offline: Set your site’s status to offline after a specific time
  • Set Site Online: Set your site’s status to online after a specific time.

Where to Find Task Scheduler

From  your Joomla dashboard navigate to the System > Manage > Scheduled Tasks

Create and Select a Task

Once you navigate to the Scheduled Tasks, click Add a Task. This should display all the pre-installed tasks that you can choose from on the basis of the task you want to carry out.

If you have had other relevant extensions previously installed then it should also show up here. In our case, we don’t have any previously installed extensions so we are left with the default tasks only.

For this tutorial, we will check how the Image Size Check scheduled task work.

Select and Create Your Task

Select the Image Size Check task from the available tasks. This should take you to a form for setting your preferred parameters. 

Set the fields according to your preference:

  • Title: Test Task
  • Execution Rule: Interval, Minutes
  • Interval in Minutes: 5
  • Directory: sampledata
  • Dimension: Width
  • Limit (px): 100
  • Maximum Images: 1

Hit Save & Close. Good job! Your task has been created. 

Check the Directory to Spot the Changes

Now since we set the directory to the existing sample images of Joomla, we head right to the sample data folder to check the changes.

From your dashboard navigate to Content > Media > sampledata > cassiopiea

Before creating the task the images were in default size as shown in the screenshot.

After setting the task, the image sizes should be resized to the dimension you set in the task. Let’s take a look at the result:

As you can see in our case, the task worked perfectly and the image has been resized accordingly.

This way, the task repeats itself after every 5 minutes (The time you set while creating the Task) to resize the images without you having to fix them individually. 

Similarly, you can go ahead and set different tasks on the basis of your need like setting your site online or offline after a certain time, and more. 

Wrapping Up

Joomla is constantly developing and advancing in its endeavor to keep up with the latest functionalities and usabilities. Have more control over when you decide to run a particular task and also get the freedom to schedule the task that fits your preference with this new feature.

Hope this tutorial was helpful to you and could give you some insight into this new addition to the Joomla world! Also, should you have any more relevant questions, do not forget to let us know in the comment section. Good Luck!