LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   File descriptor inside screen (https://www.linuxquestions.org/questions/linux-newbie-8/file-descriptor-inside-screen-753896/)

gagou7 09-09-2009 10:39 AM

[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

colucix 09-10-2009 03:48 AM

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

gagou7 09-10-2009 08:05 AM

Thank you very much !!! That's exactly what I was looking for !


All times are GMT -5. The time now is 04:24 PM.