cron jobs question for admins/people to do with usage

Status
Not open for further replies.

-fedexer-

New Member
Messages
32
Reaction score
0
Points
0
Ok well i was reading that when using Cron Jobs your account may be suspended if you have it running too often, so i have a question , how often would a script like the following be allowed to run:

Code:
<?php

$query = "SELECT * FROM table WHERE var= '1'";
$result = mysql_query($query);
$row = mysql_fetch_array($result);
$query = "SELECT * FROM table5 WHERE var2 = '1'";
$result = mysql_query($query);
$globalVars = mysql_fetch_array($result);
$lastGlobCheck = $globalVars['field4'];
$newGlobCheck = $lastGlobCheck + 1;
$query = "UPDATE table5 SET field4 = '$newGlobChecks' WHERE var2 = '1'";
$result = mysql_query($query);
 
do{
//check for socket open
$checkSock = fsockopen($row['InternetProtocol], $row['Port'], $errno, $errstr, 30);
if(!$checkSock){
$uptime = ($row['field4'] / $globalVars['field']);
$query = "UPDATE table SET field7 = '0', field8 = '$uptime' WHERE var9 = '".$row['field5']."'";
$result = mysql_query($query);
}else{
$lastChecks = $row['field7'];
$newChecks = $lastChecks + 1;
$query = "UPDATE table SET field5 = '1', field7 = '$newChecks' WHERE field6 = '".$row['field9']."'";
$result = mysql_query($query);
$uptime = ($row['field'] / $globalVars['field']);
$query = "UPDATE table SET field = '1', field2 = '$newChecks' WHERE field3 = '".$row['field5']."'";
$result = mysql_query($query);
}
fclose($checkSock);
}while($row = mysql_fetch_array($result));
$query = "SELECT * FROM table1 WHERE field = '1'";
$result = mysql_query($query);
$globalVars = mysql_fetch_array($result);
$time = time():
$query = "UPDATE table1 SET field = '$time' WHERE field5 = '1'";
$result = mysql_query($query);

exit;
?>

Obviously i have not named the tables and columns as they are for security reasons (just incase? ) if the proper named version is needed just ask, but anyway this is how the code is but with proper column names and a DB connection script being required.

How often would i be permitted to have this running? The script is used for a server list checker, where it checks all the servers stored in the DB and changes the record if it is online/offline. This is needed so users can tell what servers are on/off so they can play on them.

Every 5-10 mins would be brilliant as this is what we were aiming for.

Thanks
-fedexer-
 

-fedexer-

New Member
Messages
32
Reaction score
0
Points
0
Well that fits just perfectly with what i require, thanks alot for the very speedy reply ;)
 

DefecTalisman

Community Advocate
Community Support
Messages
4,148
Reaction score
5
Points
38
As GamingX said 5 mins should be the limit. I have a similar cron running tracking uptime of servers set at 5 min intervals.
 
Status
Not open for further replies.
Top