LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 12-26-2005, 10:58 AM   #1
agouz
Newbie
 
Registered: Dec 2005
Posts: 2

Rep: Reputation: 0
Howto get the output of a running process using ssh?


Hello, i would like to know if i can log or view the output of a running process, using ssh?
thanks.
 
Old 12-26-2005, 11:34 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
can you explain in some useful detail what you actually want to achieve?? i would assume that ssh and the contents of a process on a remote system are utterly irrelevant to one another. 1) get to remote system 2) look at whateveter it is you want... so probably ignore the first part and tell us what you actually mean for the second.
 
Old 12-26-2005, 12:04 PM   #3
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD, Raspbian, Arch
Posts: 2,331

Rep: Reputation: 357Reputation: 357Reputation: 357Reputation: 357
Quote:
Originally Posted by agouz
Hello, i would like to know if i can log or view the output of a running process, using ssh?
thanks.
If you just want to log an ssh session that you invoke:

$ ssh -l login_name machine_name 2>&1 | tee ssh_logfile.txt

Graphical ssh clients (like Putty) may have session logging built in, but I've never looked for that so I don't know for sure.

Do you mean you want to invoke ssh, and then attach to an already running process on the remote machine and see what it's writing to stdout and/or stderr? You can use "truss" to see what's going on with a running process, but that shows the low level calls, not just stdout/stderr. You have to own the process (or be root) to do this. You could also try snooping around in /proc. I don't think you can grab only stdout/stderr from there, but I could very well be wrong on that. Again, you will either need to own the process or be root to see details under /proc.

If you mean the simpler "start a process and send it's output to a logfile":

$ program_name 2>&1 >logfile.txt

...to view and log at the same time:

$ program_name 2>&1 | tee logfile.txt
 
Old 12-26-2005, 12:11 PM   #4
agouz
Newbie
 
Registered: Dec 2005
Posts: 2

Original Poster
Rep: Reputation: 0
Hello,
I would like to view the output of a running process. The process is running in a tty and the output of the process is in the stdout. How can i view the output (without restarting the process) from an another tty (i can't use myproc > /dev/pts/x because i don't want to restart the process).
thanks in advance.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Regaining output from a background process the_holysmoke Linux - Newbie 4 03-11-2011 06:48 PM
SSH connection termination during a running process... jayemef Linux - General 1 08-16-2005 11:41 AM
Problem in output to a process in perl saneax Linux - Software 2 08-31-2004 06:18 AM
Please help easy questions, how do I stop a process from running in SSH? lexington Linux - Newbie 3 05-01-2004 12:03 PM
Redirecting process output to shell mhelles Linux - Newbie 1 04-30-2003 09:30 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:04 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration