On 04/09/2017 07:25 PM, JD wrote:
ssh user_foo@1.2.3.4 "pgrep -f 'master_app' | wc -l" 2> stderr.log
would write any errors to the file "stderr.log" on the local box.
Those stderr messages would be coming from wc and NOT from ssh.
The OP's command should be
ssh user_foo@1.2.3.4 2> stderr.log "pgrep -f 'master_app' | wc -l"
That's nonsense. The stdout and stdin FDs of the remote processes don't
connect directly to your terminal. The "ssh" command reads their data
and writes them to its own stderr and stdout. Moving the redirection so
that it appears before the command argument doesn't change the results
at all. You can't redirect the stderr of ssh and *not* the stderr of
the remote processes.
_______________________________________________
users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx