Cron Job And Get Problem

Hi, <br /><br />I've been running a cron job from my account for about 2-3 months now with no problems. But as of yesterday without doing anything the cron job sends me an email everytime it tries to run it. I get an email with this error:<br /><br />/bin/sh: line 1: /usr/bin/GET: Permission denied<br /><br />I haven't changed anything, specifically any permissions. The cron job is supposed to run this command:<br /><br />GET <a href="http://jpfe:[email protected]/jpfe/loadjpfe.php" target="_blank">http://jpfe:[email protected]/jpfe/loadjpfe.php</a><br /><br />I know it includes a password in there but it doesn't really matter, I am actually going to make this a normal directory eventually.<br /><br />Has Total Choice changed some permission that might not allow me to run a php script as a cron job anymore? <br /><br />Thanks,<br />Sandro<!--content-->
I'd suggest submitting a ticket to the Help Desk and let them check things out on your server for you.<!--content-->
Thanks, I submitted a help ticket and I got the answer I was looking for.<br /><br />Here is the response if anyone has the same problem.<br /><br /><!--quoteo--><div class='quotetop'>QUOTE</div><div class='quotemain'><!--quotec-->Due to security reasons we have disabled the get and wget commands on the server. You would need to change the cron to use the format 'php -q /home/(account_username)/public_html/jpfe/loadjpfe.php' to run the script. The password protection should not matter in this case as the file is being run from your account on the server.<br />.<br />Thank you for choosing Total Choice Hosting where choice does matter! <br /><br />Rick <br /><br />Technical Support Services Manager <br />Total Choice Hosting<!--QuoteEnd--></div><!--QuoteEEnd--><!--content-->
Glad to see it was resolved... I'll keep this in mind (though presently I don't use any get commands, but you never know what the future holds...)<!--content-->
<!--QuoteBegin-spadin+Aug 1 2005, 02:08 PM--><div class='quotetop'>QUOTE(spadin @ Aug 1 2005, 02:08 PM)</div><div class='quotemain'><!--QuoteEBegin-->Thanks, I submitted a help ticket and I got the answer I was looking for.<br /><br />Here is the response if anyone has the same problem.<br /><div align="right"><a href="http://www.totalchoicehosting.com/forums/index.php?act=findpost&pid=142237"><img src='http://www.totalchoicehosting.com/forums/style_images/1/post_snapback.gif' alt='*' border='0' /></a></div><!--QuoteEnd--></div><!--QuoteEEnd--><br /><br />Just what I didn't need to see... php -q doesn't work or doesn't appear to work when I have to append command line parameters onto the script.<br /><br />For instance black nova traders, an online game has a scheduler system that runs via get. you have to append ?swordfish="password" onto the end of the php script, which never worked right unless called via a URL.<br /><br />I forsee much grief for me.<!--content-->
Welcome to the forums, cryptoknight! <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/thumbup1.gif" style="vertical-align:middle" emoid=":thumbup1:" border="0" alt="thumbup1.gif" /> <br /><br />I downloaded BlackNova Traders and looked at the scheduler.php script that's supposed to be run from a cron job. The code is basically written with the assumption that it will always be called through a web server. Cron jobs don't call PHP scripts through a web server, which is why you have to use the GET command - GET calls the script through the web server just like your browser does.<br /><br />If you're willing to add a little code to the scheduler.php script, I believe you can successfully run it in a cron job without having to use GET.<br /><br />In scheduler.php, insert the following code at line 48 (right after the long block of comments and just before the first line of actual PHP code):<br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--># Code to set PHP variables from command line arguments<br /># Runs only if not being called through web server<br />if (!isset($_SERVER['SERVER_PORT'])) {<br />    # Change to script directory, just like web server does<br />    chdir(dirname($_SERVER['argv'][0]));<br />    # Set $PHP_SELF from $_SERVER array value (just in case it's not)<br />    $PHP_SELF = $_SERVER['PHP_SELF'];<br />    # Iterate through passed args and set PHP variable for each one<br />    if ($_SERVER['argc'] > 0) {<br />        for ($i=1; $i < $_SERVER['argc']; $i++) {<br />            parse_str($_SERVER['argv'][$i]);<br />        }<br />    }<br />}<!--c2--></div><!--ec2--><br />Then in your cron job, use the following as the "Command to run":<br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->php -q /path/to/scheduler.php swordfish=password > /dev/null<!--c2--></div><!--ec2--><br />When run from a cron job, the above code will see the 'swordfish=password' on the command line and set the PHP variable $swordfish = 'password', which is what scheduler.php is expecting to see. This is what PHP does with the '?swordfish=password' part of the link when you call up scheduler.php in a web browser.<br /><br />You could also place this code in a separate file (with opening <?php and closing ?> PHP tags around the code), then just add an include() statement at line 48 in scheduler.php.<br /><br />Hope this helps...<!--content-->
Welcome to the forums, cryptoknight! <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /><!--content-->
Welcome to the forum, cryptoknight. <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /><!--content-->
Welcome to the forum, cryptoknight <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/biggrin.gif" style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" /><!--content-->
<!--QuoteBegin-TCH-David+Aug 7 2005, 03:02 AM--><div class='quotetop'>QUOTE(TCH-David @ Aug 7 2005, 03:02 AM)</div><div class='quotemain'><!--QuoteEBegin-->I downloaded BlackNova Traders and looked at the scheduler.php script that's supposed to be run from a cron job.  The code is basically written with the assumption that it will always be called through a web server.  Cron jobs don't call PHP scripts through a web server, which is why you have to use the GET command - GET calls the script through the web server just like your browser does.<br /><br />If you're willing to add a little code to the scheduler.php script, I believe you can successfully run it in a cron job without having to use GET.<br /><br />Hope this helps...<!--QuoteEnd--></div><!--QuoteEEnd--><br /><br />Thank you so much David. Making mods to files is nothing new for me... Working with php in a non-webserver like environment (i.e. not using get) is though. Thank you for your help. The mod works via phpshell, so I expect that it will work fine via cron.<br /><br />Probably would have felt less griefed if in the process of denying my access to get/wget and lynx, somebody had notified me of the change prior to its being enacted.<!--content-->
Welcome to the forum, cryptoknight<!--content-->
 
Back
Top