LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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 09-09-2009, 11:39 AM   #1
gagou7
LQ Newbie
 
Registered: Sep 2009
Distribution: Ubuntu 9.04 / Debian 5.0 / Backtrack 3
Posts: 27

Rep: Reputation: 0
[SOLVED] File descriptor inside screen


Hi,

I'm using a program called "Plowshare". It can download file automatically from megaupload, rapidshare and more.

I would like to print the progress of the download in the shell but also save it in a file. "Plowshare" print all information in stderr and it's why this command doesn't work:

Code:
plowdown -o /directory/ http://www.megaupload.com/?d=XXXXX > file.log
But with this command, all working fine:

Code:
plowdown -o /directory/ http://www.megaupload.com/?d=XXXXX 2>&1 | tee file.log
But my intention is to use it with the "screen" program like this:

Code:
screen -dmS test plowdown -o /directory/ http://www.megaupload.com/?d=XXXXX 2>&1 | tee file.log
But it doesn't work and I read on internet that "screen cleans up the file descriptors" (source).

I search a solution to redirect stderr to a file and also print it in the screen. A "tee" program but for stderr, not stdout.

Maybe someone know how to redirect stderr to a file without the file descriptor?

Thank's in advance for your help

Last edited by gagou7; 11-05-2009 at 05:37 PM.
 
Old 09-10-2009, 04:48 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
You can try the logging capability of screen itself. Tell screen to do a log of its activity: it will save the standard output and the standard error to a file, the same accomplished by tee with 2>&1 redirection. To follow the advancing of the job on the terminal, just re-attach the screen session in the usual way using
Code:
screen -r xxxxx.test
Option -L turn logging on, so that a minor change to your command line can do the trick:
Code:
screen -dmLS test plowdown -o /directory/ http://www.megaupload.com/?d=XXXXX
the log filename will be screenlog.N by default, where N is the number of the current screen window. You can use a custom filename by creating your own initialization file $HOME/.screenrc adding the line:
Code:
logfile file.log
 
Old 09-10-2009, 09:05 AM   #3
gagou7
LQ Newbie
 
Registered: Sep 2009
Distribution: Ubuntu 9.04 / Debian 5.0 / Backtrack 3
Posts: 27

Original Poster
Rep: Reputation: 0
Thank you very much !!! That's exactly what I was looking for !
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Get the absolute path of file using file descriptor. appas Programming 7 01-19-2012 12:47 PM
Too many file open - How can we define Max limit of file descriptor janeshb Linux - Server 11 09-29-2009 11:41 AM
Deleted log file - how to get back via file descriptor and keep alive? prollocks Linux - General 1 05-29-2009 10:08 AM
apt-file returns nothing; 'bad file descriptor' overbored Debian 3 10-03-2004 10:13 PM
File descriptor lido Linux - Newbie 5 07-17-2003 12:58 PM


All times are GMT -5. The time now is 02:07 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration