sdevaney Posted February 8, 2009 Share Posted February 8, 2009 I cant figure out why this cron job will not run and no errors display. Any insight is greatly appreciated. Thanks a lot in advance! <? error_reporting(E_ALL); ini_set('display_errors', '1'); include ("system/dbconnect.php"); $sth1 = mysql_query("select HeartID, RunEvery, RunTime, ModCode from heartbeat where Enabled = 'Y'") or die ('Error: '.mysql_error ()); while($datab = mysql_fetch_array($sth1)) { $time = $datab['RunTime']; $time = $time-1; if ($time <= 0) { $runcode = $datab['ModCode']; eval($runcode); $time = $datab['RunEvery']; } $sth2 = mysql_query("update heartbeat set RunTime=$time where HeartID=".$datab['HeartID'].""); } ?> Link to comment https://forums.phpfreaks.com/topic/144286-solved-cron-job-help/ Share on other sites More sharing options...
landavia Posted February 8, 2009 Share Posted February 8, 2009 $sth1 = mysql_query("select HeartID, RunEvery, RunTime, ModCode from heartbeat where Enabled = 'Y'") or die ('Error: '.mysql_error ()); u have problem in here you should type $sth1 = mysql_query("select HeartID, RunEvery, RunTime, ModCode from heartbeat where Enabled like '%Y%'") or die ('Error: '.mysql_error ()); Link to comment https://forums.phpfreaks.com/topic/144286-solved-cron-job-help/#findComment-757205 Share on other sites More sharing options...
sdevaney Posted February 8, 2009 Author Share Posted February 8, 2009 $sth1 = mysql_query("select HeartID, RunEvery, RunTime, ModCode from heartbeat where Enabled = 'Y'") or die ('Error: '.mysql_error ()); u have problem in here you should type $sth1 = mysql_query("select HeartID, RunEvery, RunTime, ModCode from heartbeat where Enabled like '%Y%'") or die ('Error: '.mysql_error ()); I am afraid that did not fix it. Thank you though. Link to comment https://forums.phpfreaks.com/topic/144286-solved-cron-job-help/#findComment-757208 Share on other sites More sharing options...
sdevaney Posted February 8, 2009 Author Share Posted February 8, 2009 OK after doing a little more digging I have found that it runs once but it wont run again and I have it set to run every 5 mins. So does that mean there is a problem with my servers cron daemon or could it be something in my db? I am at a loss here so any information is appreciated. Thanks! Link to comment https://forums.phpfreaks.com/topic/144286-solved-cron-job-help/#findComment-757583 Share on other sites More sharing options...
ashishag67 Posted February 8, 2009 Share Posted February 8, 2009 IF you can tell how have you scheduled your cronjob? what control panel has the server provided? Link to comment https://forums.phpfreaks.com/topic/144286-solved-cron-job-help/#findComment-757614 Share on other sites More sharing options...
sdevaney Posted February 8, 2009 Author Share Posted February 8, 2009 I have it set up to run every 5 mins. I used the Cron Job tab in Cpanel to set it up. If you need any other information feel free to ask. I thank you for the help. Link to comment https://forums.phpfreaks.com/topic/144286-solved-cron-job-help/#findComment-757618 Share on other sites More sharing options...
sdevaney Posted February 9, 2009 Author Share Posted February 9, 2009 I have solved the issue by using this command. /usr/local/bin/php -f /home/deltoria/public_html/runcron.php Link to comment https://forums.phpfreaks.com/topic/144286-solved-cron-job-help/#findComment-757833 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.