screen-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Start multiple screen-sessions per script


From: Frank Röhm
Subject: Re: Start multiple screen-sessions per script
Date: Wed, 4 Mar 2015 11:58:22 +0100

> Am 04.03.2015 um 01:37 schrieb Kamil Jońca <address@hidden>:
> 
> Frank Röhm <address@hidden> writes:
> 
>> Hello
>> 
>> is it possible to start multiple screen sessions with each session with an 
>> own command which is immediately started in one script?
>> I want to start only one screen, and in this screen I need many sessions 
>> (normally started with ^A,C for create), but each session should directly 
>> start a command.
>> 
> I think it should be named session ("test" in my example)
> 
> 
> screen -d -m -S test  
> screen -S test -X screen lynx pl.wikipedia.org  
> screen -S test -X screen lynx de.wikipedia.org  
> 
> KJ

My unwholy goodness!!!
This ist it! Thats it is!!!
Thank you. Thank you thank you and thank you.


I created now a small script “multiscrapes.sh” along to your command examples:

#!/bin/bash

screen -d -m -S wikiscrape 
sleep 1
screen -S wikiscrape -X screen ./scrapesession.sh A
sleep 1
screen -S wikiscrape -X screen ./scrapesession.sh B
sleep 1
# …. and so on …


in “scrapesession.sh” I have:

#!/bin/bash

cd /path/to/env-mwscrape
source bin/activate
mwscrape $1 --start $2



and ran it outside any existing screen session with:

./multiscrapes.sh

and indeed my wish comes true, detached there is a screen running with all the 
windows in it, starting already all the scripts (scrapesession.sh with its 
parameters etc)

I had to put the "sleep 1" in it, because It wouldn’t start reliable without 
it. 
This was all the time a problem I hadn’t seen, so maybe on my long way to here, 
I had already working scripts without knowing it, because nothing happens if 
the commands follow too fast each other. Maybe this is a pyhton virtualenv / 
interpreter problem. Maybe this was my real and main problem all the time.
Its difficult to find errors here, because they are shown nowhere.

An interesting detail is, that a screen window started like this gets killed 
with C+c, not only the command in it. Not a problem for me in this context.


So thank you again. All of you!

frank








reply via email to

[Prev in Thread] Current Thread [Next in Thread]