1

I want to run a private Minecraft and Teamspeak server on my little vServer. When I start all manually, it works quite well but I want my servers to start automatically on server startup.

As I run two servers, I use screen to get multiple windows. But I don't know, how I can start a screen session with two windows and execute one server in each window with a single script, running at startup.

Isn't there any possibility to start a detached screen session, send a command to execute to it, open a new window in that session and send another command to it?

I thought of something like this:

screen -dmS test -t win1              # create new screen session, name it test 
                                      #    and name the first window win1
screen -S test -X mcStart.sh          # start the minecraft server
screen -S test -X screen -t win2      # create a new window, name it win2
screen -S test -X tsStart.sh          # start teamspeak server

This doesn't sound bad in my opinion but it simply doesn't work... All I get is a screen session with two empty windows, named "win1" and "win2".

Please tell me what I have to do, to get this thing to work.

And by the way: If it is possible, I don't want to run each server in a single screen session.

1 Answer 1

4

The reason the -X doesn't work is because it's a screen command you're executing - in order to get it to run mcStart.sh and tsStart.sh, you should use:

screen -dmS test -t win1 mcStart.sh
screen -rS test -X screen -t win2 tsStart.sh
1
  • Great that's exactly it!
    – x3ro
    Jun 3, 2012 at 15:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .