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("[EMAIL PROTECTED]","$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 [EMAIL PROTECTED] -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php