screen-users
[Top][All Lists]
Advanced

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

Start multiple screen-sessions per script


From: Frank Röhm
Subject: Start multiple screen-sessions per script
Date: Mon, 2 Mar 2015 10:59:44 +0100

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.

When I am in a screen, I can run this script “example.sh":

#!/bin/bash

screen program1.sh
screen program2.sh

which starts two new sessions (as if pressed Control+A then C two times) and 
ran program1 in the first, program2 in the second. This works.
But I want to do this more automatically, because like this, I would need 50 
script files (program1.sh, program2, … program50.sh). 
I only  want to use 2 scripts with all commands in the scripts.

I tried this script "multisessions.sh”: 

#!/bin/bash

screen ./screensession.sh $1 myparam1
screen ./screensession.sh $1 myparam2


and “screensession.sh” is:

#!/bin/bash

cd /to/scripts/path
command1 $1
command2 $1


So I started my script like this:

multisession.sh myparam0

But now in my script “multisessions.sh” the second command is only started, if 
the first were finished. This is not what I want. All screen-sessions should 
open directly and start immediately their commands.

Maybe I explain it less abstract by what I want to use it for: 
I want to scrape (download) the Wikipedia (different ones) with a special tool 
(“mwscrape”) but as the wikipedia is so huge, I need to start many “scrapes” at 
the same time, each beginning from another letter.
At the moment, I do it with manual start of many sessions (Control+A, C, all my 
commands, next session with Control+A, C etc.), which is a long run.
As I re-scrape the Wikipedia from time to time, it would be nice if I had only 
two scripts, starting them with one command, which I can start each month 
automatically through cron.

Is this possible?


Thanks 

frank









reply via email to

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