LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Startup Script (https://www.linuxquestions.org/questions/linux-newbie-8/startup-script-247279/)

LtcJohnson 10-25-2004 09:07 PM

Startup Script
 
Ok I rent a box for my clan and another clans CS servers. What I want to know is how do I make a script to start the servers with having to type the below info. I would then also want to make a script that will start all the servers when the machine is rebooted ect..


Code:

screen -A -m -d -S hlds ./hlds_run -game cstrike +ip 123.234.345.456 +port 27015 +maxplayers 20 +map map_name -autoupdate
thats just for one server. didnt feel the need to list all 4 because they are basically the same except for the ips.

Boudewijn 10-25-2004 09:30 PM

Ok,


create a script in /etc/init.d, called startServer (or something like that). The content should be:

#!/bin/bash
screen -A -m -d -S hlds ./hlds_run -game cstrike +ip 123.234.345.456 +port 27015 +maxplayers 20 +map map_name -autoupdate;

After having done this, make it executable: chmod +x startServer
Then create a symlink in /etc/rc5.d .

cd /etc/rc5.d
ln -s ../init.d/startServer S97startServer

enjoy :-)

LtcJohnson 10-25-2004 11:22 PM

***EDITED***

I figured out what was wrong. Ok. Is there a way I can have this script ran as a different user? and I'd want these servers to startup after everything else is loaded.


All times are GMT -5. The time now is 11:03 AM.