Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 09-09-2009, 10:39 AM   #1
LQ Newbie
Registered: Sep 2009
Distribution: Ubuntu 9.04 / Debian 5.0 / Backtrack 3
Posts: 27

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


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:

plowdown -o /directory/ > file.log
But with this command, all working fine:

plowdown -o /directory/ 2>&1 | tee file.log
But my intention is to use it with the "screen" program like this:

screen -dmS test plowdown -o /directory/ 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 04:37 PM.
Old 09-10-2009, 03:48 AM   #2
LQ Guru
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978
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
screen -r xxxxx.test
Option -L turn logging on, so that a minor change to your command line can do the trick:
screen -dmLS test plowdown -o /directory/
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:
logfile file.log
Old 09-10-2009, 08:05 AM   #3
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 !


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

All times are GMT -5. The time now is 10:25 AM.

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