I need to ssh into a server and check for a service to see if it is up and running. What i do is to use ssh and run a command which calls that service and check the output of that command. I want to have a progress bar to show the user that the script is trying to check the status of the service; but I am not able to run the progress bar function while ssh command is not returned from the server! (ssh must wait for the service to fully start before it can check the status) and I miss that part of the progress.
Is there a standard way to deal with such a scenario?
My ssh command is something like this:
State=$(ssh host "app-status")
And it should return something like:
Status OK
3>&1
fd 3 is opened as a dup of stdout. ssh stdout is set to dup of fd3, then 3 is closed3>&-
stdout from ssh is piped into read loop, which is printed to stderr>&2
Nothing is run in background, so how does this help? – X Tian Feb 06 '14 at 11:59ssh
. The progress loop reads nothing untilssh
exits. – Stéphane Chazelas Feb 06 '14 at 12:12