javascript – shell script not being invoked via php and completion status running shell script in php-ThrowExceptions

Exception or error:

I am using php to control(start/stop) my servers. Inside php I am using shell_exec, which runs shell script and start/stop the server. Following is the code for button and further action upon button click.

<table><tr><td>Server1</td><td><form method="post"><input type="submit" class="btn btn-primary btn-xs" name ="start_as" value="start"/>
function startAS()

and below my sh file:

ssh user@ip "nohup /$path/ > /dev/null 2>&1 &"
SERVER=ip1 PORT=port1
while !(: < /dev/tcp/$SERVER/$PORT) 2>/dev/null
    echo "* Waiting for  Server to Start *"
echo "Server is Started"

The problem is when I click on “start” button, the browser hangs and I can not see shell script being run on server, request expert guidance here. Also, if there is anyway wherein I can show two updates in popup window showing task started and task completed.


How to solve:

Leave a Reply

Your email address will not be published. Required fields are marked *