Koozali.org: home of the SME Server

Contribs.org Forums => General Discussion => Topic started by: weblance on March 24, 2011, 01:49:24 PM

Title: Can I create a cronjob that executes external PHP script?
Post by: weblance on March 24, 2011, 01:49:24 PM
Is ti possible to create a cronjob on the SME that executes an external PHP script once every hour? If yes, how?

/Carl
Title: Re: Can I create a cronjob that executes external PHP script?
Post by: Stefano on March 24, 2011, 01:55:31 PM
please, define "external"

php has a cli too
Title: Re: Can I create a cronjob that executes external PHP script?
Post by: weblance on March 24, 2011, 02:28:27 PM
please, define "external"

php has a cli too

External: http://www.remotedomain.com/script.php
Title: Re: Can I create a cronjob that executes external PHP script?
Post by: Stefano on March 24, 2011, 02:40:43 PM
a script that use wget or curl in cron.d or crontab should do what you need..

do you expect to send parameters? do you need to get any result?
Title: Re: Can I create a cronjob that executes external PHP script?
Post by: weblance on June 16, 2011, 11:42:31 PM
Sorry for the late reply.

I do not need to send any parameter and i don't get a result. I only need to run a script on a remote server. Is there a timeout? What I mean is that the remote script can take several minutes to excute.
Title: Re: Can I create a cronjob that executes external PHP script?
Post by: Stefano on June 17, 2011, 12:06:53 AM
Sorry for the late reply.

I do not need to send any parameter and i don't get a result. I only need to run a script on a remote server. Is there a timeout? What I mean is that the remote script can take several minutes to excute.


wget is your friend :-)
man wget for more details
Title: Re: Can I create a cronjob that executes external PHP script?
Post by: weblance on June 17, 2011, 12:13:41 AM
Thank you very much!

I'll check wget out. What about execution time, is there a limit? The script can take several minutes to complete...
Title: Re: Can I create a cronjob that executes external PHP script?
Post by: Stefano on June 17, 2011, 10:44:41 AM
I'll check wget out. What about execution time, is there a limit? The script can take several minutes to complete...

read the man page, you'll find the answer
Title: Re: Can I create a cronjob that executes external PHP script?
Post by: CharlieBrady on June 17, 2011, 04:24:32 PM
The script can take several minutes to complete...

Most web browsers and most web servers won't allow it to complete if it takes that long.
Title: Re: Can I create a cronjob that executes external PHP script?
Post by: Jean-Philippe Pialasse on June 23, 2011, 07:14:06 AM
the problem with timeout can be avoid on the webserver side using the comand set time limit in the loop (i guess there is some loop in it ;)
each time it will set the timeout it will be reseted to 0 ... set a timeout value for one pass in the loop ( 10 seconds per pass should be enough)

http://php.net/manual/en/function.set-time-limit.php

usually the timeout is 30 second to complete all the script