bash - capturing output of vncserver execution via SSH -
I am trying to automate the process of starting a VNC server on a remote computer (by which I am automatic I'm guided by a login server) and connecting it to the bash.
The idea is that the VNC server starts the command via SSH. The output of this command is parsed to get the details of the VNC server and then a connection is established to the VNC server.
I'm having trouble capturing the output of the VNC server start command and is welcome
ssh user1@lxplus.cern.ch 'vncserver: The VNC server start command is executed remotely via SSH:
ssh user1@lxplus.cern.ch 'vncserver'
< P> This will produce an output such as the following: New 'lxplus0180.cern.chhew (user1)' desktop is lxplus0180.cern .ch: 2 /afs/cern.ch/user/ Logs in the applications that are started in u / user1 / .vnc / xstartup I have / AFS / CRNK / User / U / User / 1 / VNC / LXPlus 0180.cern.ch: 2.log
I can parse this output like this Such as the following:
"$ {response}". Sed '/New.*desktop.*is/!d' | Awk -F "Desktop" '{print $ 2}'
This will be something like this:
lxplus0180.cern.chhew
The VNC connection can be established using this information.
How can I record this feedback so that I can parse it? Is this a more effective way to parse this information (possibly adding a location before the colon for the purposes of connection command vncviewer
)? Is it usually an easy way to do this which I am trying to do here?
The VNC server passes the startup event output to the standard error output stream, it should be captured in a variable As the following:
VNCServerResponse = "$ (SSI" $ {address1} "'vncserver' 2 & gt; and 1)"
Comments
Post a Comment