Error In Script

From: Date: Fri, 07 Jun 2002 16:20:20 +0000
Subject: Error In Script
Groups: php.windows 
Request: Send a blank email to php-windows+get-14129@lists.php.net to get a copy of this message
I created this script to ping a host and if a response is not received then insert into a database and ping it after x amount of minutes. The script works fine until it starts to ping the hosts that it didn't receive a response from the database then it goes to page cant be displayed. I need to script to entire script to run constantly but with a delay before it runs that's why I am using the sleep(); Please help. <?php sleep(300); mysql_connect("localhost"); $bquery = "delete from josh.down_sites where id!=0"; $bresult = mysql_query($bquery); mysql_connect("localhost"); $query = "SELECT * FROM josh.temp order by id"; $result = mysql_query($query); while($myrow=MySQL_fetch_array($result)) { $site=$myrow["site"]; $ping = ping -n 10 $site; if (eregi("request", $ping)) { $time = date("H:i:s"); $aquery = "insert into josh.down_sites values('','$site','$time')"; $aresult = mysql_query($aquery); } } sleep(150); $cquery = "SELECT * FROM josh.down_sites order by id"; $cresult = mysql_query($cquery); while($myrow=MySQL_fetch_array($cresult)) { $site=$myrow["site"]; $ping = ping -n 10 $site; if (eregi("request", $ping)) { $time = date("H:i:s"); mail("jevans@acs.roadway.com","$site","This is a e-notice from HD_Service_Scan that as of $time $site is currently down or experiencing performance problems."); } } ?> Josh Evans ACS Helpdesk Programmer jevans@acs.roadway.com

« previous php.windows (#14129) next »