Managing services

Jeff Vian jvian10 at charter.net
Wed Mar 31 00:06:44 UTC 2004



Rick Stevens wrote:

> Fabrício Santos wrote:
>
>>
>> 1. service command.
>>
>> I know a service in /etc/init.d (or /etc/rc.d/init.d/) may be started 
>> using
>> the service command but I couldn't find any proper docs on it. No man 
>> page
>> available. No --help switch available. Only the following is 
>> displayed when
>> the command is run:
>>
>>    Usage: service < option > | --status-all | [ service_name [ command
>> | --full-restart ] ]
>>
>> Are there any more extensive docs to this utility?
>
>
> "service" is _very_ similar to chkconfig.  "service" is also a pretty
> simple shell script and is found in /sbin.  Take a look at it.

Service is a script that does exactly in functionality what the command 
line call to the init script would do.  
For example,   "service network start"  does the same as 
"/etc/init.d/network start" would do.

>
>> 2. /etc/rcX.d
>>
>> Inside the rcX.d directories, there are files named K99servicename and
>> S99servicename. I supose the K stands for Kill at reboot or halt 
>> time, and S
>> stands for Start at bootup time. Then the numbers are just a way of 
>> sorting
>> the way the services are started or stopped. Is this correct? Where 
>> can I
>> learn more on these matters?
>
>
> That is correct.  When _entering_ a run level, all of the "Sxxyyyy"
> scripts are executed in ASCII sort order.  When _leaving_ a run level,
> all of the "Kxxyyyy" scripts are run, again in ASCII sort order, then
> the run level is changed and the "Sxxyyyy" scripts in the new rcx.d
> directory are run.  And so it goes.  BTW, ASCII sort order is the
> same as you'd get if you did "ls -l /etc/rc.d/rcx.d/S*".
>
> Most reasonably complete system admin manuals explain this.  You might
> want to pick up one of the Linux-specific administration manuals
> available from O'Reilly, Sybex, Prentiss-Hall or other publishers.


Not quite true.
The Kxxxxxx scripts are run when entering the run level as are the 
Sxxxxx scripts.
The differenc is the Kxxxxx scripts make sure the service named is NOT 
running and the Sxxxxxx scripts make sure those services are started.
 Leaving a run level does nothing from that rcX.d directory, but rather 
uses the ones in the new runlevel entry to control what happens.

>
>> 3. ln -s /etc/init.d/httpd S35httpd
>>
>> Is there any FC1 text based utility that may create these links
>> automatically instead of forcing the way manually like I did?
>
>
> "chkconfig", "ntsysv", "redhat-config-services" would all do it.  One
> of the lines in the /etc/rc.d/init.d version of the script controls
> which link would be created.  Again, you want it to be "S85httpd", not
> "S35httpd", and the line that would control how one of the above
> utilities created the link is:
>
>     # chkconfig : - 85 15
>
> The "-" means it's not to be started by default in any run level. The
> "85" means that the "Sxx" link should be "S85httpd", and the "15" means
> the "Kxx" link should be "K15httpd" (start late, terminate early).
>
>> Thanks for your help!
>
man chksonfig to see how to use it and control the services.  You can 
even add new services in /etc/init.d and use chkconfig to set them up.

>





More information about the users mailing list