Solved

Linux : view output of already running processes in linux

Posted on 2014-01-28
4
937 Views
Last Modified: 2014-01-28
I am running a SOME shell scripts in the background that prints some progress information to the stdout ie terminal. ($ nohup perl script001.pl &)

As all these scripts takes few days to get completed  I will have to logout. This loses the output to the terminal. Is there anyway to regain the progress output for any specific process when i log back in?

I know i could pipe the output to a file, but I don't really want to do that.

Any ideas on this would be greatly appreciated

I hope you clearly  understood question, prior you give me the answer
0
Comment
Question by:mac_g
  • 2
  • 2
4 Comments
 
LVL 8

Accepted Solution

by:
Surrano earned 400 total points
ID: 39814614
1. Use nohup. It will make sure the process keeps running even after the user session has ended.

2. Use screen and enable screen logging.

3. If you have already started then spy on file descriptors, e.g. for PID=1234:
tail -f /proc/1234/fd/1

Open in new window

0
 

Author Comment

by:mac_g
ID: 39814652
it is pefect ...

working good  ...

what is fd,1 ... in the above command ??
0
 
LVL 8

Expert Comment

by:Surrano
ID: 39814709
fd is "file descriptors" and 1 is the standard output.
0 is standard input, 2 is standard error. The rest are arbitrary file descriptors opened by the process.
0
 

Author Comment

by:mac_g
ID: 39814716
thanks for your help ...
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

You ever wonder how to backup Linux system files just like Windows System Restore?  Well you can use Timeshift in Linux to perform those similar action.  This tutorial will show you how to backup your system files and keep regular intervals. Note…
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now