Re: Managing services

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jeff Vian wrote:


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.

You're correct. I had been working on a modified Solaris box and let it taint my answer.

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.

Correct. Solaris runs through the scripts differently.

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.
----------------------------------------------------------------------
- Rick Stevens, Senior Systems Engineer     rstevens@xxxxxxxxxxxxxxx -
- VitalStream, Inc.                       http://www.vitalstream.com -
-                                                                    -
-      A day for firm decisions!!!   Well, then again, maybe not!    -
----------------------------------------------------------------------



[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux