Jump to content

[SOLVED] Cron Issue


Sinikka

Recommended Posts

Hi I'm pretty new at this so sorry if I don't come across to clearly. I'm having a problem with a cron, instead of executing the cron every 15 minutes like it's supposed to it's setting the last run for each job like it already executed and bypassing it. Here's the query that's not working correctly.

 

$dailyCron = mysql_query("SELECT * FROM cron WHERE game = '$game' AND weekly_run = '0' AND monthly_run = '0' AND (last_run is null or last_run != now())");

while ($getDailyCron = mysql_fetch_array($dailyCron))

{

$explodeCronTime = explode(":", $getDailyCron[cron_time]);

$cronHour  = $explodeCronTime[0];

$cronMin   = $explodeCronTime[1];

if ($cronHour > 12) { $cronHour -= 12; } 





if (($cronHour < $hour2) or ( $cronHour == $hour2 AND $cronMin <= $minute))

{

	$cronName = $getDailyCron[cron_name];

	$run[$cronName] = 1;

	mysql_query("UPDATE cron SET last_run = now() WHERE game = '$game' AND id = '$getDailyCron[id]'");

	mysql_query("UPDATE cron SET total_runs = total_runs + 1 WHERE game = '$game' AND id = '$getDailyCron[id]'");

}

}

Link to comment
https://forums.phpfreaks.com/topic/73486-solved-cron-issue/
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.