On 04/09/2017 06:02 PM, Samuel Sieb wrote:
On 04/09/2017 04:34 PM, bruce wrote:
the cmd -->> ssh user_foo@1.2.3.4 pgrep -f 'master_app' | wc -l
works, as it runs the pgrep 'xxx' | wc -l all on the remote box..
Actually, it doesn't. The "wc -l" will be run on the local box, but
hopefully you're getting the same result either way. In order to run
it on the remote box, you would need to run something like:
ssh user_foo@1.2.3.4 "pgrep -f 'master_app' | wc -l"
i've checked this and it's giving thee correct expected value.
Sure, you should get the same result either way.
however I realized that there might be "ssh command timeout" errs that
I hadn't thought about, so I was wondering how to capture the ssh
STDERR to be able to see the err.
so the STDERR would the stderr for the local box running the ssh and
not the remote from the "pgrep" action.
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"
_______________________________________________
users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx