Re: screen, detached, stdout

Andrew McGlashan <andrew.mcglashan-eCNwZfdMfp8leAitJ8REmSkBLnlaf3ui@public.gmane.org>
Newsgroups gmane.comp.gnu.screen.user
Organization Affinity Vision Australia Pty Ltd
Message-ID <[email protected]>
Hi,

Nico Schlömer wrote:
> I would like to start a series of jobs in the background and log their
> stdout in specific files. The idea is to use screen for this, and I
> went ahead and typed
> 
> $ screen -d -m /path/to/my/exec
> 
> which puts the job nicely in the background. Let's log stdout:
> 
> $ screen -d -m /path/to/my/exec | tee output.log

What's wrong with using the -L option?

As a test, I created the following alias and ran it fine.

# alias ns9='if [ -f screenlog.0 ];then rm screenlog.0;fi && 
(/usr/bin/screen -S root -L -d -m time /usr/local/bin/program.sh; tail 
-99f screenlog.0) && mv screenlog.0 my-test-screenlog.out'


# ns9

That seems to work nicely!

And I know it's finished when I see the "time" output.

If you want to run multiple sessions, then you might need to create a 
working directory for each one and start the command in each directory 
so that it will always have it's own screenlog.0 file.


Cheers

-- 
Kind Regards
AndrewM

Andrew McGlashan
Broadband Solutions now including VoIP
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.