keke

~
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

转载《Starting and Stoping Services: insserv》

Posted on 2009-05-14 11:55  可可  阅读(458)  评论(0)    收藏  举报

http://susefaq.sourceforge.net/faq/services.html

 

Starting and Stoping Services

SuSE is using insserv to control the runlevel links in an automatic fashion. This section tries to address questions related to creating and maintaing runlevel links.

1. How can I start services at boot time ?
2. Why do my runlevel symlinks change order ?
3. I can't find chkconfig where is it ?
4. How can I stop hwscan from starting at boot time ?
1.

How can I start services at boot time ?

 

To start a service:
$ insserv named
            
To stop a service from starting:
 $ insserv -r named
            

 

Note

You can also use YaST Control Center->System->Run level editor+Runlevel properties

Have a look at insserv(8) manual page for in detail explanations.

INSSERV(8)            The SuSE boot concept            INSSERV(8)
            Insserv - Enable an installed system init script
            Enables an installed  system  init  script  (`boot
            script')  by  reading  the  comment  header of the script,
            e.g.:
            ### BEGIN INIT INFO
            # Provides:       boot_facility_1 [ boot_facility_2 ...]
            # Required-Start: boot_facility_1 [ boot_facility_2 ...]
            # Required-Stop:  boot_facility_1 [ boot_facility_2 ...]
            # Default-Start:  run_level_1 [ run_level_2 ...]
            # Default-Stop:   run_level_1 [ run_level_2 ...]
            # Description:    multiline_description
            ### END INIT INFO
            and calculating  the  dependencies  between  all  scripts.
            

If you are interested in making your own init script for a custom program to start at boot time look at /etc/init.d/skeleton. You can use this example to create your own.

2.

Why do my runlevel symlinks change order ?

"insserv", is changing the run level links. Every time a package including an init script is being installed, it calls insserv in its %post section to install the required run level links. Have a look at the insserv(8) and init.d(7) man pages. Probably your init script is lacking the required comments in the header that determine the default run levels and startup dependencies (as specified by the LSB).

Tip

Have a look at SuSE Package Conventions document if you are creating your own rpms or for a deeper understanding of SuSE RPM internals. Note that this document is still work in progress...

3.

I can't find chkconfig where is it ?

Applies to SuSE 8.0

The equivalent is insserv, refer to the previous question for detailed info about man pages and other explanations.

CHKCONFIG(8)                                         CHKCONFIG(8)
            NAME
            chkconfig - enable or disable system services
            SYNOPSIS
            chkconfig -t|--terse [names]
            chkconfig -s|--set [name state]
            chkconfig -e|--edit [names]
            chkconfig -l|--list [--deps] [names]
            chkconfig -a|--add [names]
            chkconfig -d|--del [names]
            DESCRIPTION
            chkconfig  is used to manipulate the runlevel links at boot time
            (see init.d(7)).  It can be thought of as a frontend to insserv(8).
            Chkconfig can run in six different  modes:  terse  list  mode,  set
            mode,  edit mode, list mode, add mode and delete mode. The last three
            modes were added for compatibility reasons
            

 

4.

How can I stop hwscan from starting at boot time ?

  1. Fire up YAST

  2. Select "System"

  3. Select "Runlevel Editor"

  4. Select "Runlevel Properties"

  5. Select (from list) "hwscan"

  6. Click "Set/Reset"

  7. Select "Disable the service"

  8. Click "Finish"

An alternative procedure is as follows

It's a service called "hwscan", started from the Links in /etc/init.d/rcX.d where X is your runlevel. To see in which runlevels your script is invoked :

# chkconfig -l script
            

Normally you could remove the scripts with:

# insserv -r script
            

in your case:

# insserv -r hwscan