Mike Chambers wrote:
While you can use a variety of tools to set up run levels for services, here's how to do it with chkconfig:
what I've seen you have to link it as [S/K]XXyyyyyy in order for theBut what happens if you unlink/remove it from your rc3.d dir? Does services
services program to 'see' it.
still see it so you can add it to a particular run level?
Mike
1. Add some lines to the main script you put in /etc/init.d/. Here
are the lines for one of the services on my system here:
#!/bin/bash
#
# Init file for OpenSSH server daemon
#
# chkconfig: 2345 55 25
# description: OpenSSH server daemon
The "chkconfig" line means roughly: "activate this service for
levels 2,3,4, and 5; start as a 55, but stop as a 25". For your
custom service, you'd change the numbers on this line accordingly (I
just compare to other services, taking into account dependancies of
my custom service upon other services).
2. Now do "chkconfig my_new_service add", which will set up the links
in the rcN.d directories for you automatically, followed by
"chkconfig my_new_service on", which will activate the service.
3. Once you do this, and assuming that you've put in the right code
in your script, "service my_new_service start" starts the service
manually, and "service my_new_service stop" stops it.
Hopefully this makes pretty clear what chkconfig is doing, and what service is doing.
Note that if you do things this way, you don't need to mess with a run level editor at all, or edit any of the links manually.
--
Rob Thorne
Chief Technical Officer
Torenware Networks