Peter
Peter

Reputation: 132197

Script for opening GNU screen or similar with lots of the same process

I'd like to type (at bash)

./start_screen.sh 3 some_cmd with parameters

and have it start up GNU screen with three separate, independent copies of the running command some_cmd with parameters running in bash in three separate vertically-split windows. What's the best way to do this? Does someone know how to put the pieces together?

(This is so I can run three worker daemons in the background and monitor them in one window.)

NOTE: alternatives to screen are just fine. In fact, at worst, it's ok if you can't interact with the windows apart from killing them all at once. (I mostly just want to see the outputs in parallel.)

Upvotes: 2

Views: 228

Answers (1)

Keith Thompson
Keith Thompson

Reputation: 263237

screen executes commands from $HOME/.screenrc on startup by default.

You can override this with the -c option.

Create a temporary file with the commands you want, then run screen -c your-file.

This won't get the default settings you already have in $HOME/.screenrc unless you copy them to the temporary file.

(Disclaimer: I haven't tried this.)

Upvotes: 3

Related Questions