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.