1. tonis
  2. RO CSVI
  3. Friday, 20 September 2019
  4.  Subscribe via email
Hello,

I have problems to set up a real cron on my hosting. So I have tried to change the file cron.php to a custom file, which operates only with one import template, so I do not need to add any parameters. But it does not work.

Could you please check the file? All changed lines have a comment "change".
Attachments (1)
Accepted Answer Pending Moderation
Hello,
We do not support custom changes for free.

Wanted to ask if you tried frontend URL cron import? With frontend import you don't need any custom code.You can take a look at Run cron URL on frontend document to know to set it up. Let me know if it works.
Kind regards,

Tharuna

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
  1. more than a month ago
  2. RO CSVI
  3. # 1
Accepted Answer Pending Moderation
Thanks for your reply.

Yes I have created a front end import menu item, it works ok if I access the menu item directly.

But if I try to call that url with cron, it does not work. Or Im doing something wrong...
  1. more than a month ago
  2. RO CSVI
  3. # 2
Accepted Answer Pending Moderation
Hello,
But if I try to call that url with cron, it does not work. Or Im doing something wrong...

You cannot use frontend URL as a cron URL. It won't work. To run the frontend URL without a browser you need to use a batch file and using CURL or WGET call the frontend URL in the batch file.
Kind regards,

Tharuna

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
  1. more than a month ago
  2. RO CSVI
  3. # 3
Accepted Answer Pending Moderation
Hello,

I would like to understand what the main problem is that you are facing. The main problem is your hosting company not offering a real cronjob support as I understand.

What can you setup in your cronjob? Perhaps we should look at that and check what is possible from there.
Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
  1. more than a month ago
  2. RO CSVI
  3. # 4
Accepted Answer Pending Moderation
Thanks for reply,

I have send some screanshots of the types of configuration of cron.

First is a script with possible 4 parameters. But in the script input you can add only a file from the web server, clear, with no parameters, it calls the right php accordng to the first chosen option. In the parameters you can not add some characters like quotes, without quotes (key=thekey, --key=thekey) it does not work.

The wget can call url with possible url parameters ...cron.php?key=thekey... but this is not an option for your application I think.
Attachments (3)
  1. more than a month ago
  2. RO CSVI
  3. # 5
Accepted Answer Pending Moderation
here is a mail output send from the server after the cron execution

Error: Failed to start application: Failed to start the sessionJob 'PHP_INI_SCAN_DIR=/usr/php72/lib/phpini-cli.d /usr/sbin/webcron /usr/php72/bin/php '/path-to-file/administrator/components/com_csvi/helper/cron.php' key=thekey template_name=import' terminated (exit status: 1) (mailing output)
  1. more than a month ago
  2. RO CSVI
  3. # 6
Accepted Answer Pending Moderation
Hello,

I really don't understand why hosting companies don't just offer the Linux cron as it is but instead build their own solutions. Looking at the options you have a batch file is not working because there is no way to call it.

Let's look at the wget option. Here you should be able to enter a URL, this could be a front-end URL. What you need to do to use that is the following:

  1. Create a new menu item
  2. Select the type Import front-end
  3. Select the template you want and enter the secret key in the menu. This secret key must also be set in the template and they need to match
  4. On the Link Type tab set the Display in menu to No This forces the menu item not to show on the site.
  5. Check if the link works by running it manually. This would be something like https://yoursite.com/menu-alias. Replace yoursite.com with your own domain name and menu-alias by the alias you have given your menu item.
  6. If the import works, you can enter the URL in your wget URL address
  7. Run the job and see if it works.


Give that a try and let us know how it goes.
Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
  1. more than a month ago
  2. RO CSVI
  3. # 7
Accepted Answer Pending Moderation
Thanks for advice.

I have tried this approach several times before, but everytime with the same result - the menu item frontend link works only if I manualy acess the site, import goes as it should.
But while automatic wget cron option, the import does not work. The email output after the import sends the whole html code of the trigered frontend site. The log shows the start time of the import, but nothing more...
Attachments (1)
  1. more than a month ago
  2. RO CSVI
  3. # 8
Accepted Answer Pending Moderation
Hello,
But while automatic wget cron option, the import does not work. The email output after the import sends the whole html code of the trigered frontend site. The log shows the start time of the import, but nothing more...

Few things to check
1. Is the access level on the menu item used for cron set to Public?
2. In RO CSVI Logs page, what is the details you see for this cron import? Can you post a screenshot on that?
Kind regards,

Tharuna

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
  1. more than a month ago
  2. RO CSVI
  3. # 9
Accepted Answer Pending Moderation
Hello,

The email output after the import sends the whole html code of the trigered frontend site.
The problem I think is that CSVI uses Javascript to run an import to circumvent any timeouts. This means it loads the page and then starts the import by means of Javascript calls. The Javascript doesn't get executed because of wget.

Last idea that I have is that you hack the cron.php file as you did in your first post. When you say, it doesn't work you need to explain in more detail what doesn't work because now it is just too little info. I looked at your changes in the file, they look OK to me.
Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
  1. more than a month ago
  2. RO CSVI
  3. # 10
Accepted Answer Pending Moderation
Hello,

1. Is the access level on the menu item used for cron set to Public?
Yes the access is set to public
2. In RO CSVI Logs page, what is the details you see for this cron import? Can you post a screenshot on that?
In attachments. The lines with start and end time are manualy trigered frontend link, with correct import. The lines without end time are the wget trigered frontend links.

...

The problem I think is that CSVI uses Javascript to run an import to circumvent any timeouts. This means it loads the page and then starts the import by means of Javascript calls. The Javascript doesn't get executed because of wget.
Yes it seems so. The email output has also this message in the component section ...
The last server response has not been received in a timely fashion. The server may still be busy or stopped the process. You can wait a little longer to see if the server will sent a response or cancel the process.

When you say, it doesn't work you need to explain in more detail what doesn't work because now it is just too little info. I looked at your changes in the file, they look OK to me.
I try to run the changed cron file as a php 7.2 script. I addet the path to the changed file, with hardcodet template_id, secret and key. After the cron is trigered, there are any new logs. The email uotput send only this ...
Error: Failed to start application: Failed to start the sessionJob 'PHP_INI_SCAN_DIR=/usr/php72/lib/phpini-cli.d /usr/sbin/webcron /usr/php72/bin/php  '/server/path/administrator/components/com_csvi/helper/cron2.php'' terminated (exit status: 1) (mailing output)
Attachments (1)
  1. more than a month ago
  2. RO CSVI
  3. # 11
Accepted Answer Pending Moderation
Hello,

Actually, the import is working when triggered via the wget instance except it never finishes because you only have 30 seconds in total to run the complete import and the import needs more than the 30 seconds. That is a limitation set by your hosting provider and a cronjob is generally not limited to. As a test you can see if the import finished if you only import 3 records. If that successfully finishes, the only way to have the full import run is to increase the timeout for your hosting package.

As for triggering the cron script, there is an important message there:
Error: Failed to start application: Failed to start the session
This most likely means that some data has already been outputted or the session has already been started. Both cases I cannot do anything about because this happens before the script is actually triggered.

If you have SSH access, you can try and run the script manually from the command line and see what happens there.
Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
  1. more than a month ago
  2. RO CSVI
  3. # 12
Accepted Answer Pending Moderation
Hello,

Actually, the import is working when triggered via the wget instance except it never finishes because you only have 30 seconds in total to run the complete import and the import needs more than the 30 seconds.
I thing this is not the problem. The limit on the server was set to 60 seconds, and the import needs only about 10 seconds. I have set the limit to 600 second and addest a smaller import file with only few records, the manual import has finished in less than 1 second. The wget cron has the same unsuccessfull result.
I make a mistage before. The sentence "The last server response has not been received in a timely fashion. The server ..." was only a part of javascript, it was not actualy shown as a text output on the site.

This most likely means that some data has already been outputted or the session has already been started. Both cases I cannot do anything about because this happens before the script is actually triggered.
I wrote one more time on the hosting support, what they can do about it.

If you have SSH access, you can try and run the script manually from the command line and see what happens there.
Yes there is a shell console, but limited to one hour :) . If I want to use it repeatedly (for a cron), i must pay some extra.
  1. more than a month ago
  2. RO CSVI
  3. # 13
Accepted Answer Pending Moderation
Hello,

Based on your feedback I think we can be sure that the wget option is not going to work. So I did a check myself with cURL as well but same output as you. It loads the page but as these programs have no Javascript, nothing happens with it.

So I did some test with your cron2.php file and after removing line 165 - 172 it did start to run. In my case there is no session error which you have at your host. Assuming that your host fixes that problem, this is your best bet for running such a poor man's cron.
Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
  1. more than a month ago
  2. RO CSVI
  3. # 14
  • Page :
  • 1


There are no replies made for this post yet.
Be one of the first to reply to this post!