Re: Start multiple screen-sessions per script

Frank Röhm <[email protected]>
Newsgroups gmane.comp.gnu.screen.user
Message-ID <[email protected]>
> Am 04.03.2015 um 01:37 schrieb Kamil Jońca <[email protected]>:
> 
> Frank Röhm <[email protected]> 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






_______________________________________________
screen-users mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/screen-users
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.