You are here:  » Cron jobs


Cron jobs

Submitted by Halion on Fri, 2015-09-11 12:47 in

Hi David,

My host has changed the interface for entering cron jobs.

Now only the following fields are allowed : (shown at bottom of this post,I tried to attach a screenshot but I don't think its allowed.)

When I use /scripts/cron.php?password=xxxx in the URI / Path field it grabs the feeds and begins importing, then times out after 60 seconds.

fetch.php @ALL or slow_import.php do not work as there can be no spaces in the URI / Path field. Have you any ideas how to get round the 60 sec timeout?

Thanks

Mike

Name

Use https://

Hostname
www

URI / Path
The path and querystring of the URL to be requested (e.g. /subfolder/file.php)

HTTP Username
If the URL to be requested is protected with basic HTTP authentication, specify those credentials here.

HTTP Password
Change?

Additional Request Headers
If the URL to be requested requires additional HTTP headers, specify those headers here.

Submitted by support on Fri, 2015-09-11 13:06

Hello Mike,

Ideally for a large site /scripts/cron.php should be invoked via the command line however the script does make a set_time_limit(0); call which would disable any time limit imposed by your web server, so if you don't experience the 60 second timeout when importing large feeds manually via the /admin/ area then it might just be your host's CRON process that times out and therefore adding the code to ignore user abort might be all that's needed.

To do this, edit scripts/cron.php and look for the following code at line 2:

  set_time_limit(0);

...and REPLACE with:

  set_time_limit(0);
  ignore_user_abort();

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by Halion on Fri, 2015-09-11 13:57

Hi David,

Am trying the edit you suggested to scripts/cron.php now, giving it an hour or so to see if the feed is imported. I normally use slow_import when manually importing via the admin area as I get 500 error after a while if I use the standard import function.

Will report back.

Regards

Mike

Submitted by Halion on Fri, 2015-09-11 14:29

Have given it a good hour to import, but checking the status showed the same 60 sec timeout. Never mind, I'll have to see about doing it manually it seems. Thanks for your help.

Regards

Mike

Submitted by support on Sat, 2015-09-12 08:29

Hi Mike,

If set_time_limit(0); is disabled by your configuration it might still be possible to override it a php setting in .htaccess. Try creating a .htaccess file in the /scripts/ folder as follows;

php_value max_execution_time 0

Otherwise, it might be worth contacting your host to ask if now that you are required to invoke a web URL as your CRON process whether you can have the PHP time limit disabled, either for your account or the /scripts/ folder specifically as max_execution_time can be enabled on a per-directory basis. If you wanted to include the folder name in your request, go to /admin/ > Support Info and copy the Install Path value with scripts/ added to the end...

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by Halion on Mon, 2015-09-14 13:58

Hi David,

Thanks very much for your help on this, unfortunately it didn't solve it, so I guess I will have to try contacting the host as you suggested.

Regards

Mike