08-31-2008, 08:13 PM
Do as Ryan suggested. Have one startup script for each instance, and then have another startup script to execute all those separate startup scripts.
For example I've got these scripts to start, stop and restart my css server:
start.sh:
stop.sh:
restart.sh:
Note that in the start.sh I've got parameter "-S csds" for screen. That sets name "csds" for the new screen session. You could have for example "-S dods" and "-S tf2" for your DoD:S and TF2 servers. Then correspondingly you would have to use "screen -dr dods -X quit" in your stop.sh script.
When you have those scripts set for each individual server, write separate script which launches the servers one by one. For example you could have:
The cool thing is that you don't need to worry about which dir you are in, because all the individual startup scripts have their own "cd" command as the first line. Also the script is easy to use because it doesn't matter whether the servers are already running or not. The script will first shut down and then restart any server that's running. That's why this is easy to use for example in cron to make the servers reboot at night.
For example I've got these scripts to start, stop and restart my css server:
start.sh:
Code:
#!/bin/sh
cd /home/user/csds/
screen -A -m -d -S csds ./srcds_run -game cstrike -console +maxplayers 32 +port 27015 +ip 1.2.3.4 -tickrate 66 +map de_dust2
screen -r csds
stop.sh:
Code:
#!/bin/bash
screen -dr csds -X quit
restart.sh:
Code:
#!/bin/bash
/home/user/csds/stop.sh
sleep 10
/home/user/csds/start.sh
Note that in the start.sh I've got parameter "-S csds" for screen. That sets name "csds" for the new screen session. You could have for example "-S dods" and "-S tf2" for your DoD:S and TF2 servers. Then correspondingly you would have to use "screen -dr dods -X quit" in your stop.sh script.
When you have those scripts set for each individual server, write separate script which launches the servers one by one. For example you could have:
Code:
#!/bin/bash
/home/user/csds/restart.sh
sleep 1
/home/user/tfds/restart.sh
sleep 1
/home/user/dods/restart.sh
The cool thing is that you don't need to worry about which dir you are in, because all the individual startup scripts have their own "cd" command as the first line. Also the script is easy to use because it doesn't matter whether the servers are already running or not. The script will first shut down and then restart any server that's running. That's why this is easy to use for example in cron to make the servers reboot at night.