开发者

Why would you set the same values in Required-start as you did for Required-stop in a init.d script?

开发者 https://www.devze.com 2023-02-28 17:01 出处:网络
The Debian wiki gives the following example for \'INIT INFO`: ### BEGIN INIT INFO # Provides:scriptname

The Debian wiki gives the following example for 'INIT INFO`:

### BEGIN INIT INFO
# Provides:          scriptname
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Defa开发者_运维问答ult-Stop:      0 1 6
# Short-Description: Start daemon at boot time
# Description:       Enable service provided by daemon.
### END INIT INFO

Then the documentation says the following about Required-stop:

Required-Stop: boot_facility_1 [boot_facility_2...]

defines facilities used by the service provided by the script. The facility provided by this script should stop before the listed facilities are stopped to avoid conflicts. Normally you would include here the same facilities as for the Required-Start keyword.

Isn't it pointless to set the same values to Required-Start if it's not going to run until the facility is stopped?


Required-Stop: boot_facility_1 [boot_facility_2...]

defines facilities used by the service provided by the script. The facility provided by this script should stop before the listed facilities are stopped to avoid conflicts. Normally you would include here the same facilities as for the Required-Start keyword.

Required-Stop is used to indicate that listed facilities should not be stopped before the ones provided by the current script are stopped.

This is to prevent, for example, $remote_fs from being stopped and your NFS mounted /usr and /var being unmounted before your database server has a chance to shutdown safely and properly save the database to the filesystem.


An additional example: I run VirtualBox inside a VNC server, started by two different init scripts.

I want the VirtualBox to close before VNC. Because if VNC closes first, VirtualBox may be killed instead of shutting down cleanly!

So I specify that my VirtualBox init scripts depends on VNC for starting up, and also for closing down.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号