Chapter 7. Automation and CRON scripts

[Note]Note

This feature is not available in Akeeba Ticket System Core.

Akeeba Ticket System can benefit from the periodic execution of optional, administrative tasks. If you want to allow your clients to create new tickets or reply to existing ones over email you also need to set up a scheduled task for that too.

There are two ways Akeeba Ticket System can help you automate tasks:

  • CRON jobs with the Joomla CLI application. If your server gives you access to real CRON jobs, executing command line scripts periodically, this is the preferred method. Automated tasks execute outside of your web server and are not bound to the same time limitations as loading pages on your site. Moreover, since the web server and most of Joomla is not loaded they tend to be more memory efficient and faster than any other method.

  • URLs for CRON jobs. There's a special, password-protected URL you can use to execute maintenance tasks automatically. Since they run outside the context of a visitor accessing your site they do not slow your visitors down. However, since they are still accessed through your site, they are bound by the same time limits as any other page load of your site. Furthermore, third party plugins loading on your site may cause unintended effects, increase the memory consumption and slow down the execution of ATS CRON tasks executed this way. This is only recommended when your host does not allow you to create real CRON jobs. You can uses the URLs with pseudo-CRON (access a URL at specified intervals) either provided by your host or a third party service such as WebCRON.

In all of the above cases the CRON commands executing are the same. They are provided by plugins in the ats group. A cheatsheet with the available CRON commands and links to the respective plugins' documentation can be found at the end of this chapter.

Why not use the scheduled tasks feature in Joomla 4.1 and later?

This feature WILL be supported in a future release.

At the time we finished working on Akeeba Ticket System 5 for Joomla 4 in November 2021 this Joomla feature wasn't ready yet. In fact, it was still being worked on for inclusion in the development build for Joomla 4.1 which is to be released in February 2022.

Once Joomla 4.1 reaches a Release Candidate state we will work on integrating Akeeba Ticket System's scheduled tasks with Joomla's scheduled tasks feature. Considering that we also have our internal release cycle we expect this feature to be included in a public release within 1–2 months of Joomla 4.1's release. The benefit for us and you is that having a common scheduler makes things far more consistent and easier to manage.

CLI script for CRON jobs

[Note]Note

This feature is only available in Akeeba Ticket System Professional.

This is the recommended method for scheduling Akeeba Ticket System CRON tasks on your site.

The big picture

Setting up a CLI script for a CRON job is generally a fairly simple task. You need to know the path to your PHP CLI executable and the path to your site.

The command line script you need to execute to perform CRON tasks is stored under your site's cli directory and is called joomla.php. This is the Joomla CLI Application, an official script shipped with Joomla itself (it's already present on your site; we do not install it ourselves).

Therefore you need to enter a command line similar to the following to your server's CRON job manager:

/usr/local/bin/php /home/USER/webroot/cli/joomla.php ats:cron CRONCommandName

where /usr/local/bin/php is the path to your PHP CLI executable and /home/USER/webroot is the absolute path to your web site's root. You can get this information from your host.

The CRONCommandName is the name of the CRON command. Please consult the CRON Commands section of this documentation for a list of available CRON command names.

Here are some very important notes:

  • You MUST publish the Console - Akeeba Ticket System plugin and set its Access to Public. This plugin lets the Joomla CLI Application know about the ats:cron command and how to run it.

  • We cannot know and document the path to your PHP CLI executable. Please ask your host about it. Also note that sometimes hosts will give you the path to the PHP CGI binary. This will NOT work properly with the Joomla CLI Application script. CGI (Common Gateway Interface) and CLI (Command Line Interface) are a world apart. The former is designed to run scripts which will be served as web pages. The latter is designed to run command line scripts, usually for use with CRON.

  • We cannot know the path to your site and document the exact path to Joomla's CLI Application script. However, you can always go to Akeeba Ticket System's control panel page and click the Automation tab. It will give you the exact path to the CLI script. It can do that because it runs on the same server which will be executing the CRON task, therefore it can figure out the correct path for you.

Setting up a CRON job in cPanel

Go to your cPanel main page and choose the CRON Jobs icon from the Advanced pane. In the Add New CRON Job box on the page which loads, enter the following information:

Common Settings

Choose the frequency of your backup, for example once per day.

Command

Enter your CRON command as explained above. For example:

/usr/local/bin/php /home/USER/webroot/cli/joomla.php ats:cron CRONCommandName

Finally, click the Add New Cron Job button to activate the CRON job.