LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-05-2003, 06:09 AM   #1
the_holysmoke
LQ Newbie
 
Registered: Nov 2003
Posts: 2

Rep: Reputation: 0
Regaining output from a background process


I am running a perl script in the background that prints some progress information to the stdout ie terminal.
(cmdline: nohup perl script.pl &)

As this script takes some time to run (~3days) I will have to logout. This loses the output to the terminal.
Is there anyway to regain the output 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.
 
Old 11-05-2003, 07:54 AM   #2
Azmeen
Senior Member
 
Registered: May 2003
Location: Malaysia
Distribution: Slackware, LFS, CentOS
Posts: 1,307

Rep: Reputation: 47
type jobs to see the list of background processes...

and type fg job number to bring it to the foreground.

The job number is in square braces.
 
Old 11-05-2003, 07:57 AM   #3
Azmeen
Senior Member
 
Registered: May 2003
Location: Malaysia
Distribution: Slackware, LFS, CentOS
Posts: 1,307

Rep: Reputation: 47
Quote:
Originally posted by Azmeen
type jobs to see the list of background processes...

and type fg job number to bring it to the foreground.

The job number is in square braces.
Edit: Barghh... replied too fast, anyway, eventhough you mentioned that you prefer not to pipe the output into a file, but IMHO, that's the only way to do it. You could just grep the important bits of the output if you know the pattern, that might improve the signal to noise ratio of your output log.
 
Old 03-11-2011, 04:27 PM   #4
DrHorrible
LQ Newbie
 
Registered: Mar 2011
Posts: 1

Rep: Reputation: 0
screen

I realize this thread hasn't been touched in a long time, but it's still at the top of Google's results, so I thought I'd contribute an answer.

screen would be great. Start up the command in a screen session, detatch, and then reattach later. To see output that has scrolled past the top of the screen, go into copy mode with C-a [ (and get out with escape).

If you Google "I'm Feeling Lucky" for 'the beauty of screen' you can follow scenario 1.
 
Old 03-11-2011, 06:48 PM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,362

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
I agree that 'screen' is the literal answer to the OP qn, but (personally) I would always log to a file just in case the process dies, gets killed, system reboots etc.
 
  


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
really background a process Henster Linux - Newbie 1 07-01-2005 05:29 AM
how to run any binary in background - background process tej Linux - Newbie 1 08-16-2004 12:27 AM
Background Process mojozoox Linux - General 1 08-26-2003 02:16 PM
Background process h8r Linux - Newbie 5 01-13-2003 04:21 PM
Regaining Process Control mikeyt_333 Linux - General 5 03-21-2002 02:21 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:35 PM.

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