linux - pipe timely commands to ssh -


i trying pipe commands opened ssh session. commands generated script, analyzing results, , sending next commands in accordance.

i not want put commands in script on remote host, , run script, because interested in status of ssh process: sending locally commands allow "test" whether ssh connection alive or not, , appropriate return code ssh process.

i tried using along these lines:

$ mkfifo /tpm/commands $ ssh -t remote </tmp/commands 

and term:

$ echo "command" >> /tmp/commands 

problem: ssh tells me no pseudo-tty opened stdin, , closes connection "command" terminates.

i tried approach:

$ ssh -t remote <<eof  $(echo "command"; while true; sleep 10; echo "command"; done) eof 

but then, nothing flushed ssh until eof reached (in case, never).

do of have solution ?

stop closing /tmp/commands before you're done it. when close pipe, ssh stops reading it.

exec 7> /tmp/commands. # open once echo foo >&7           # write multiple times echo bar >&7 exec 7>&-              # close once 

you can additionally use ssh -tt force ssh open tty on remote.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

How to get multiresult with multicondition in Sql Server -