$authValues = getCookieData($authValues); $software = $authValues['software']; $serverValues = checkCookieExists("serverdetails"); $serverValues = getCookieData($serverValues); deleteMyCookie("info"); deleteMyCookie("serverdetails"); deleteMyCookie("apidetails"); $ip = $serverValues['serverAddresses']['public'][0]; include 'header3.php'; flush_buffers(); print "<h3>Deploying {$software} ..<h3>"; print "<h3>Waiting on the server to start up .."; flush_buffers(); $i = 0; $y = 2; while (!checkSSH($ip)) { $i++; echo "."; sleep(1); flush_buffers(); if ($i > 120) { print "<br /></h3>There seems to be a problem. It took longer than 120 seconds to start the build. You can check your <a href=\"https://manage.rackspacecloud.com/\">control panel</a> and visit the console of the server to see if it is responsive. You can try rebooting the server or <a href=\"/\">starting over</a>.</h3><br /> I'll try {$y} more timesy.."; include 'footer2.php'; flush_buffers(); $i = 0; $y--; if ($y = 0) { exit(1); } } }
<?php include 'lib/functions.php'; function checkSSH($host_ip) { exec("/usr/lib64/nagios/plugins/check_ssh {$host_ip}", $output = array(), $return); if ($return == 0) { return true; } else { return false; } } @apache_setenv('no-gzip', 1); @ini_set('output_buffering', 0); @ini_set('zlib.output_compression', 0); @ini_set('implicit_flush', 1); ob_start(); while (!checkSSH('174.143.202.140')) { echo "waiting..<br>"; flush_buffers(); } echo "SSH is up!";