为什么要在必需启动中设置与 init.d 脚本中必需停止相同的值?

发布于 2024-11-03 07:22:00 字数 775 浏览 4 评论 0原文

Debian wiki 给出了“INIT INFO”的以下示例:

### BEGIN INIT INFO
# Provides:          scriptname
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start daemon at boot time
# Description:       Enable service provided by daemon.
### END INIT INFO

然后文档说明了以下关于必需停止的内容:

必需停止:boot_facility_1 [boot_facility_2...]

定义服务使用的设施 由脚本提供。设施 该脚本提供的应该停止 在列出的设施之前 停下来避免冲突。 通常情况下 你会在这里包括相同的 所需启动设施 关键字。

如果 Required-Start 在设施停止之前不会运行,那么为 Required-Start 设置相同的值不是毫无意义吗?

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
# Default-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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

南冥有猫 2024-11-10 07:22:00

必需停止:boot_facility_1
[boot_facility_2...]

定义脚本提供的服务所使用的设施。这
该脚本提供的设施
应该在列出的内容之前停止
设施被停止以避免
冲突。通常你会包括
这里的设施与
必需的开始关键字。

Required-Stop 用于指示在当前脚本提供的设施停止之前不应停止列出的设施。

例如,这是为了防止在数据库服务器有机会安全关闭并将数据库正确保存到文件系统之前,$remote_fs 被停止以及 NFS 挂载的 /usr 和 /var 被卸载。

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.

澜川若宁 2024-11-10 07:22:00

另一个例子:我在 VNC 服务器内运行 VirtualBox,由两个不同的初始化脚本启动。

我希望 VirtualBox 在 VNC 之前关闭。因为如果VNC先关闭,VirtualBox可能会被杀死而不是干净地关闭!

因此,我指定 VirtualBox 初始化脚本依赖于 VNC 来启动和关闭。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文