darkfreaks Posted June 10, 2008 Share Posted June 10, 2008 ok i have never done anything wiith cronjob before. the cronjob wont execute right.tpl. here is the full path: /home/soutlnet/public_html/main/right.tpl it is not executing the file and in the file i put a query : <?php $result[0]= mysql_query("DELETE todayview FROM videos"); ?> is there something that is causing it not to execute the cron ??? Quote Link to comment Share on other sites More sharing options...
discomatt Posted June 10, 2008 Share Posted June 10, 2008 It doesn't seem like PHP is executing that script. http://htmlcenter.com/blog/running-php-scripts-with-cron/ Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted June 10, 2008 Author Share Posted June 10, 2008 would chmoding it to 777 make it execute or do i need to do something code wise ??? Quote Link to comment Share on other sites More sharing options...
discomatt Posted June 10, 2008 Share Posted June 10, 2008 Did you read the article I posted? If you did, you would have a better understanding of how cron jobs work, and would be able to diagnose the problem on your own. The issue is you're not using PHP to parse the file. Quote Link to comment Share on other sites More sharing options...
rarebit Posted June 10, 2008 Share Posted June 10, 2008 mmm php /home/soutlnet/public_html/main/right.tpl Quote Link to comment Share on other sites More sharing options...
rarebit Posted June 10, 2008 Share Posted June 10, 2008 or if it's not local I use 'wget'... Quote Link to comment Share on other sites More sharing options...
discomatt Posted June 10, 2008 Share Posted June 10, 2008 Or take the easy way out and use rarebit's solution You should read the article regardless... and for sure if the above poster's solution doesn't work. Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted June 10, 2008 Author Share Posted June 10, 2008 according to my host they changed it to the correct path. however i put the cronjob in a PHP file and put permissions to 755 so it would execute and it still has not. ??? Quote Link to comment Share on other sites More sharing options...
rarebit Posted June 10, 2008 Share Posted June 10, 2008 What full options have you used with cron? I'd personally use wget over lynx because you can craft cookies and forms etc... Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted June 10, 2008 Author Share Posted June 10, 2008 i setup a cronjob in cpanel to execute the file every other minute :-\ Quote Link to comment Share on other sites More sharing options...
jonsjava Posted June 10, 2008 Share Posted June 10, 2008 What full options have you used with cron? I'd personally use wget over lynx because you can craft cookies and forms etc... wget=uber power. So many switches and abilities, it's crazy. Quote Link to comment Share on other sites More sharing options...
DarkWater Posted June 10, 2008 Share Posted June 10, 2008 Paths don't matter right now. You NEED to tell cron to run that script with the PHP binary, not /bin/sh. Okay? Please, at least TRY to do what we're telling you to do before you dismiss it and try to explain why we're wrong. Quote Link to comment Share on other sites More sharing options...
rarebit Posted June 10, 2008 Share Posted June 10, 2008 For this type of thing i'll generally just dump something to a log file. Since your using cpanel i'd suggest using wget... Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted June 10, 2008 Author Share Posted June 10, 2008 my question is shouldnt it be executing the file and executing the query ??? Quote Link to comment Share on other sites More sharing options...
jonsjava Posted June 10, 2008 Share Posted June 10, 2008 ok i have never done anything wiith cronjob before. the cronjob wont execute right.tpl. here is the full path: /home/soutlnet/public_html/main/right.tpl it is not executing the file and in the file i put a query : <?php $result[0]= mysql_query("DELETE todayview FROM videos"); ?> is there something that is causing it not to execute the cron ??? Is that all that's in the file? if so, you're missing the part where it executes it. adding if ($result[0]){ //do something } [code] or something like that. If you do execute it, and we just aren't seeing it, sry. [/code] Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted June 10, 2008 Author Share Posted June 10, 2008 ok i put if result to run the query else to error. would that run it ??? Quote Link to comment Share on other sites More sharing options...
rarebit Posted June 10, 2008 Share Posted June 10, 2008 what happens when you call the page normally? Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted June 10, 2008 Author Share Posted June 10, 2008 my code: <?php ini_set('error_reporting',E_ALL); $result[0]= mysql_query("DELETE todayview FROM videos")or die(mysql_error()); if ($result[0]){ mysql_query("DELETE todayview FROM videos")or die(mysql_error()); echo "query successful!"; } ?> Quote Link to comment Share on other sites More sharing options...
DarkWater Posted June 10, 2008 Share Posted June 10, 2008 I don't think that you understand what he said before. =X You don't need that if () if you're not running any more code. Quote Link to comment Share on other sites More sharing options...
jonsjava Posted June 10, 2008 Share Posted June 10, 2008 I'm guessing you also have your db connection stuff, but are leaving it out for security reasons. Here's a simpler code. <?php if (mysql_query("DELETE todayview FROM videos")){ echo "query successful!"; } ?> Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted June 10, 2008 Author Share Posted June 10, 2008 yeah i dont need any more queries. i just want to know why it wont execute the cron :-\ Quote Link to comment Share on other sites More sharing options...
DarkWater Posted June 10, 2008 Share Posted June 10, 2008 yeah i dont need any more queries. i just want to know why it wont execute the cron :-\ What EXACTLY do you have as your cronjob? Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted June 10, 2008 Author Share Posted June 10, 2008 */2 3 *** Quote Link to comment Share on other sites More sharing options...
jonsjava Posted June 10, 2008 Share Posted June 10, 2008 cron job to run: */2 * * * * php /home/soutlnet/public_html/main/right.tpl &1>/dev/nul &2>/dev/nul it will run it every 2 minutes, and discard any screen output (send it to /dev/nul) Quote Link to comment Share on other sites More sharing options...
DarkWater Posted June 10, 2008 Share Posted June 10, 2008 Make the output redirect to /dev/null, not /dev/nul. =P Quote Link to comment Share on other sites More sharing options...
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.