I have written a piece of code that will install a software on the server. It all works perfectly but for one part of the code.
When i start using read() and write() it does what it should. I tell it to yum install several softs and then start screen so when the page would fail the install of the software would still continue. So that is all going well. Then i start with installing vestacp for example.
$ssh->read('/.*@.*[$|#]/', NET_SSH2_READ_REGEX);
$ssh->write("yum install screen wget -y
");
$ssh->setTimeout(10);
$ssh->read('/.*@.*[$|#]/', NET_SSH2_READ_REGEX);
$ssh->write("screen
");
$ssh->setTimeout(10);
$ssh->read('/.*@.*[$|#]/', NET_SSH2_READ_REGEX);
$ssh->write("curl -O http://vestacp.com/pub/vst-install.sh
");
$ssh->setTimeout(10);
$ssh->read('/.*@.*[$|#]/', NET_SSH2_READ_REGEX);
$ssh->write("bash vst-install.sh
");
$ssh->setTimeout(10);
$ssh->read('/.*@.*[$|#]/', NET_SSH2_READ_REGEX);
$ssh->write("y
");
$ssh->read('/.*@.*[$|#]/', NET_SSH2_READ_REGEX);
$ssh->write("webmaster@yourdomain.com
");
$ssh->read('/.*@.*[$|#]/', NET_SSH2_READ_REGEX);
$ssh->write("vps.yourdomain.com
");
$ssh->read('/.*@.*[$|#]/', NET_SSH2_READ_REGEX);
$ssh->read('/.*@.*[$|#]/', NET_SSH2_READ_REGEX);
$output = $ssh->read('/.*@.*[$|#]|.*[P|p]assword.*/', NET_SSH2_READ_REGEX);
So it start the installation process. This is all activated from a ajax function and the data stored in output is being showed by jquery in a div.
But, and here is the problem. After about a minute ajax is getting the success data back and outputs the $output in a div. When i open the command line and reattach screen -r i see the install is still running. This is also the reason i use screen so i am certain that the process continues even when things go wrong in the browser.
So now i am looking for a solution to make sure that i do not see the output too soon. What if i would install something that is taking two hours. I want it to show my loading animation for like 2 hours. This is very important or it would like the software installed much faster then it really did.
Who can help me here.
thanks.