Managing services

Rick Stevens rstevens at vitalstream.com
Tue Mar 30 21:46:04 UTC 2004


Fabrício Santos wrote:
> Viva a todos,
> 
> Since at install time of my FC1 I did a pretty dumb instalation, Apache and
> Samba were not automatically configured to start at boot up and I have done
> it manually after. What I did was going to /etc/rc3.d and issued the
> following command:
> 
>    ln -s /etc/init.d/httpd S35httpd

The default is "S85httpd".  You want it to start pretty late in the
process, to make sure the rest of the system is ready to go.

> Now I have a couple of questions and a couple of assumptions that I believe
> true but am not sure about. So answers to my questions or links to further
> reading will be most welcome.
> 
> 
> 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.

> 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.

> 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!

You're welcome! ;-)
----------------------------------------------------------------------
- Rick Stevens, Senior Systems Engineer     rstevens at vitalstream.com -
- VitalStream, Inc.                       http://www.vitalstream.com -
-                                                                    -
-          Consciousness: that annoying time between naps.           -
----------------------------------------------------------------------





More information about the users mailing list