Hi there,
we are using a cron job to export a XML for Google Merchant once a day.
Until now (used with Joomla 3) we created a cron job (CLI) on our server with the following parameters.
/htdocs/administrator/components/com_csvi/helper/cron.php -- --key="mysecretkey" --template_id="1"
Now we migrated the site to Joomla 5 and I want to use sheduled task so that I only need one cron job on the server which triggers all sheduled tasks.
But I am a little helpless on how to set up the task.
I wanted to use the GET request. I have read that the cron job now works a little different.
Can I just put the following command into the URL field of the GET task?
https://www.domain.de/cli/joomla.php rocsvi:export --template_id=1 --key=mysecretkey
Or do I need to use something else?
Kind regards,
Tanja
- Picannick
- RO CSVI
- Tuesday, 21 January 2025
- Subscribe via email
0
Accepted Answer
Pending Moderation
Hi Tanja,
The new cron command does not work via the URL, the Joomla cron only runs via CLI just like the old cron does not work via the web browser. The only way I can think of is that you create a menu item for the template you want to run and point your scheduled task to the URL of the menu item. That at least works for me. Be aware, anything that runs longer than 30 seconds is most likely going to be terminated by the server. As this is not a real cron and therefore called the Poor Mans Cron
RO CSVI has not been tested with the Scheduled Tasks in Joomla as most users schedule cronjobs via the control panel of their hosting provider or directly in the crontab of the server.
Let me know if that helps.
I have read that the cron job now works a little different.In Joomla 5 we have proper cron jobs that run via the Command Line Interface, hence the name of the folder in joomla is cli. So all cronjobs can be triggered via the Joomla CLI instead of every extension having their own way of doing things, there is now a uniform way of triggering cronjobs.
The new cron command does not work via the URL, the Joomla cron only runs via CLI just like the old cron does not work via the web browser. The only way I can think of is that you create a menu item for the template you want to run and point your scheduled task to the URL of the menu item. That at least works for me. Be aware, anything that runs longer than 30 seconds is most likely going to be terminated by the server. As this is not a real cron and therefore called the Poor Mans Cron

RO CSVI has not been tested with the Scheduled Tasks in Joomla as most users schedule cronjobs via the control panel of their hosting provider or directly in the crontab of the server.
Let me know if that helps.
Kind regards,
RolandD
=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
RolandD
=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
Accepted Answer
Pending Moderation
Hi Roland,
thank you for your answer.
Just confirming that I understood it right:
So in the template I need to activate frontendcron? And then I create a menu item for the template, enter the secret key and trigger the URL via sheduled task?
As the secret key and the template ID is already set in the menu item, I do not need to add any URL parameter, do I?
And because of the timeout problem I have to test if the XML creation works properly?
Kind regards,
Tanja
thank you for your answer.
Just confirming that I understood it right:
So in the template I need to activate frontendcron? And then I create a menu item for the template, enter the secret key and trigger the URL via sheduled task?
As the secret key and the template ID is already set in the menu item, I do not need to add any URL parameter, do I?
And because of the timeout problem I have to test if the XML creation works properly?
Kind regards,
Tanja
Accepted Answer
Pending Moderation
Hello Tanja,
Yes that is correct.
You don't need to add them to URL. When you create a menu item with secret key and template ID, link will be generated with these details. You can just copy the URL and use it for cron.
If export takes longer and hits server limits then there is a possibility to get timeout problem. It is good to check if export finishes without any issue.
So in the template I need to activate frontendcron? And then I create a menu item for the template, enter the secret key and trigger the URL via sheduled task?
Yes that is correct.
As the secret key and the template ID is already set in the menu item, I do not need to add any URL parameter, do I?
You don't need to add them to URL. When you create a menu item with secret key and template ID, link will be generated with these details. You can just copy the URL and use it for cron.
And because of the timeout problem I have to test if the XML creation works properly?
If export takes longer and hits server limits then there is a possibility to get timeout problem. It is good to check if export finishes without any issue.
Kind regards,
Tharuna
=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
Tharuna
=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
- Page :
- 1
There are no replies made for this post yet.
Be one of the first to reply to this post!
Be one of the first to reply to this post!
Please login to post a reply
You will need to be logged in to be able to post a reply. Login using the form on the right or register an account if you are new here. Register Here »