Results 1 to 4 of 4
I'm looking for the best way to create a chkconfig compatible script. Basically, I have some game servers I'm running (Counter-Strike Source and other HL2 mods) that I want to ...
- 03-01-2009 #1Just Joined!
- Join Date
- Mar 2009
- Posts
- 2
How to create initscript that is chkconfig compatible
I'm looking for the best way to create a chkconfig compatible script. Basically, I have some game servers I'm running (Counter-Strike Source and other HL2 mods) that I want to start up when the box is fully booted and be able to control them easily by typing: "service cssource-server1 stop/start", and each server having a different service name so they are easily recognized. I already have a create a file which simply contains the line to execute and start the server, but how do I make it chkconfig compatible, include the script in /etc/init.d so it starts at boot up, and control it using the "service" command.
Thanks in advance,
- 03-01-2009 #2
Hi,
The way I do it is to copy one of the existing scripts in /etc/init.d to a new name.
You will see chkconfig related lines in the comments at the top. Modify these to suit your needs.
Then:
chkconfig --add <new_script_name>
service <new_script_name> start|stop|restart...
- 03-02-2009 #3Just Joined!
- Join Date
- Mar 2009
- Posts
- 2
The scripts have so much code in them. Wouldn't I need to change all of that to suit the application that I'm trying to start?
- 03-02-2009 #4
Not really. Most of them have a initialization section, then a section for each of the start,stop,restart etc commands that you pass.
Delete the bits that you don't need, and replace the start and stop commands with appropriate ones for your servers.
Should be 10 mins work tops.


Reply With Quote
