Hello, I came up with this script to inform me when a certain server is going online. I am not sure if php is the best choice here, so what do you think?
<?phpecho "Script started.";$fp1 = fsockopen($ip1, $port1, $errno1, $errstr1, 2);$fp2 = fsockopen($ip2, $port2, $errno2, $errstr2, 2);$fs1_sent = 0;$fs2_sent = 0;while(!$fp1 or !$fp2){echo "Last update".date("H:i:s");if (($fp2 = fsockopen($ip2, $port2, $errno2, $errstr2, 2)) and $fs2_sent == 0) {mail($_POST[mailaddr], $subject1, " ");$fs2_sent = 1;}if (($fp1 = fsockopen($ip1, $port1, $errno1, $errstr1, 2)) and $fs1_sent == 0) {mail($_POST[mailaddr], $subject2, " ");$fs1_sent = 1;}sleep(60);}?>