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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.