Another useful idea is running a cron job (as root) every so often on each machine that opens a socket connection to a port (eg. for www: 80)
If the socket connection returns false, you have a problem. You could then reboot the service (in this case apache or similar). I did this to check mysql was running on our old server.. It always seemed to crash at awkard times... Luke Woollard -----Original Message----- From: Petre Agenbag [mailto:[EMAIL PROTECTED]] Sent: Wednesday, 19 February 2003 12:17 AM To: Subject: [PHP] script to check if server is up Hi I have two servers on two different networks. I would like to implement some sort of a watchdog application between the two to inform me should either of the machines go down or has a connection problem. I was thinking along the line of using a PHP script running from cron on an hourly basis to "ping" the server as well as another server such as google.com (they seem to be always up) and to only raise the alarm when google can be reached, but NOT the other server. My only problem is with the actual recognition of a "failed" ping, or for that matter a successful one? Can anyone give me some brain food as to the code for detecting a up/down connection? pseudo code: make connection with server1 get result of connection_server1 make connection with google.com get result of connection_google if connection_google && !connection_server1 sms me else chill out and a plus would be to do this ONLY if the result of the next cron-run is the same, ie, don't sms me if the problem has been fixed within an hour. I just don';t know what to use to "make connection" and "get result of connection" Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php