I am trying to set up crontab to run a file on my server: http*//www*resalebroker*com/real-estate-books/cronf.php I am having trouble writing a successful path to that file. Can anyone help? Home Directory: /hsphere/local/home/resale CGI Directory: /usr/bin/php -> /usr/bin/php PHP: .php Thanks!
I haven't got an exact answer for you, but in my experience the best way to find the answer to this question is to try and run the procedure from the command line. When you can make the command execute from there you will have the right path and syntax.
You would want to use something like curl to execute it from the shell then... for example /usr/bin/curl http://www.resalebroker.com/real-estate-books/cronf.php Code (markup):
If your script is designed to work from a shell, you can do /path/to/php http://www.resalebroker.com/real-estate-books/cronf.php Code (markup):
Try the following link in the heading Compiled CGI http://www.htmlcenter.com/tutorials/tutorials.cfm?id=155&type=PHP Not sure if you have placed the line in cronf.php as it states you need to do in this page. Hope it helps.
In fact, he could use: /pathtophp/php -q /pathtoscript/cronf.phpThe problem is that his host will not tell him (if they even understand the question at their tech-support level) what the correct /pathtophp/ and php invocation are. That sorta makes it a little harder. (Or, putting it another way, knowing those two simple things answers the question.) He has turned in, I believe, five "trouble tickets" so far (the "live support" reports "we don't have documentation on that--turn in a trouble ticket and our experienced technical people will answer your problem instantly", thus providing dictionary makers with new definitions for "answer" and "instantly".) This should be a heads-up to those who think web hosting is a commodity. The /pathtoscript/ is no problem; but the other part is, regrettably, a question that--owing to its particularity (what are the path and the PHP invocation on that server)--no one but his host can answer.
My host server just sent me this message: "Please, don't run your php scripts in cron. That's not a good idea because it overloads a server." Is it me or did I really pick the wrong host?
It depends on how often you run the cronjob and how process intensive it is. Most hosts will allow you to run custom scripts/processes during off hours.
This program would be scheduled to run at 1:00 a.m. in the morning daily. I currently run the program manually every day during peak time.
It is also noteworthy that the script in question opens a URL, reads the first header line, closes the URL, and exits. Period, the end. Real server-intensive.