ostrich99 Posted May 25, 2005 Posted May 25, 2005 All, I've read the recent cron threads here, but I'm still not exactly sure what I need to do to set this up. I've opened the Cron setup tool in CPANEL and selected the frequency I want the command to run, but I'm still confused as to what to put in for the command. Basically I want it to run a php file like *****/maint/file.php should the command be: GET *****/maint/file.php > /dev/null and is the > /dev/null needed? Thanks for the guidance. Paul Quote
TCH-Don Posted May 25, 2005 Posted May 25, 2005 just try /home/your-tch-cpanel-name/path-to-file/file.name if the file is in a folder below the public_html folder, use /home/your-tch-cpanel-name/public_html/folder-name/file.name Quote
TweezerMan Posted May 25, 2005 Posted May 25, 2005 should the command be: >GET *****/maint/file.php > /dev/null and is the > /dev/null needed? <{POST_SNAPBACK}> GET makes a web page request through the web server, just like a browser does, and whatever the web server sends back is returned to the command. In a cron job, any output by a command is interpreted to be an error and e-mailed to the user. The "> /dev/null" discards the output from the GET command, so cron won't be triggered into sending an e-mail when you don't want it to. (Yes, it is probably needed.) Not too long ago, I tried using GET in a cron job on my account and it did not work. I had to use an alternate form of the GET command to get it working: >lwp-request -m GET http://www.my-TCH-site.com/path/to/file.php > /dev/null Instead of using GET, you might want to try the following in your cron job instead: >php -q /home/cpanelName/path/to/file.php just try/home/your-tch-cpanel-name/path-to-file/file.name if the file is in a folder below the public_html folder, use /home/your-tch-cpanel-name/public_html/folder-name/file.name <{POST_SNAPBACK}> This will work if the file has a shebang line for the first line of the file. Without it, a cron job can't run the script file directly. A PHP script would need the following as the first line in order to be run directly in a cron job: >#!/usr/bin/php Quote
a__kc Posted September 8, 2005 Posted September 8, 2005 Just want to add that wget -q -t 2 --delete-after http://mysite.net/script.php does not appear to work (at least on my server). You get a /bin/sh: line 1: /usr/bin/wget: Permission denied Same thing with using Lynx the text-based browser (this used to work): /bin/sh: line 1: /usr/bin/lynx: Permission denied Quote
TweezerMan Posted September 8, 2005 Posted September 8, 2005 Access to GET, wget, and lynx has been removed from the servers as a security measure. You would need to modify your script so it can be run without using these tools. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.