Re: ssh stderr question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





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



[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux