Jump to content

[SOLVED] Cron Job Help


sdevaney

Recommended Posts

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

$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

$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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.