nginx - 对于像 supervisord 这样的进程 Controller ,RHEL init.d 脚本中的 chkconfig 行应该设置为什么?

标签 nginx init rhel supervisord init.d

我正在尝试写一个 init.d第一次启动脚本supervisord过程。主管是流程 Controller /经理,如 runit , upstart , 或 systemd .如果系统重新启动,我希望它自动启动,以便它可以启动我的应用程序。

我用过这个 tldp tutorial作为基础写 init.d脚本。它工作正常,但我不明白我应该如何修改文件中的这一行:

# chkconfig: 2345 95 05

此行的教程中的注释指出:

Although these are comments, they are used by chkconfig command and must be present. This particular line defines that on runlevels 2,3,4 and 5, this subsystem will be activated with priority 95 (one of the lasts), and deactivated with priority 05 (one of the firsts).



RHEL doc解释各种运行级别如下:
0 - Halt
1 - Single-user text mode
2 - Not used (user-definable_
3 - Full multi-user text mode
4 - Not used (user-definable)
5 - Full multi-user grapical mode
6 - Reboot

从这些选择中,我想我想在 35 上运行我的,假设 1 仅适用于系统管理员。

有几个例子 supervisord init.d脚本,例如 here .我注意到所有的 RHEL init.d脚本包含以下行:
# chkconfig:    345 83 04

在这种情况下,作者有什么理由希望它在“未使用”的运行级别 4 上处于事件状态?

我安装的 nginx init.d 脚本包含这一行:
# chkconfig:   - 86 16
- 有什么用意思是这里的运行级别?

为什么这一行不包含停用优先级?

如何决定进程 Controller 的优先级,如 supervisor ?上面的脚本选择了 83 和 04,而 tldp 教程选择了 95 和 05。

最佳答案

chkconfig:    345 83 04

In this case, what reason could the authors have to want it to be active on runlevel 4, which is "not used" ?



由于未使用运行级别 4,因此您将其设置为打开或关闭都没有关系。 345更容易写,懒惰的方法。

你以后可以随时更改它
chkconfig --list supervisord
chkconfig --level 4 supervisord off
chkconfig --level 3 supervisord on

The nginx init.d script that I installed contains this line:


chkconfig:   - 86 16

What does the - mean for the runlevel here?



这意味着您必须用级别替换破折号或保持原样由 chkconfig 设置
chkconfig:   345 86 16

Why does this line not contain a deactivate priority?


345 run levels
86  activate priority
16  deactivate priority

How does one decide upon the priority levels for a process controller like supervisor? The scripts above chose 83 and 04, whereas the tldp tutorial chose 95 and 05.



这些只是例子,并不是真正的东西,它们的设置不同。

优先级通常无关紧要,因为您不会定期启动或关闭您的机器,我不熟悉您的应用程序,我会推荐这个。

此网址包含不同的优先级
https://rayed.com/wordpress/?p=1496
    chkconfig: 345 64 36

或保持原样,让 chkconfig 为您配置它
chkconfig: - 64 36

我在我的系统 centOS 上检查了我的答案,新建议:

使用 yum 安装 supervisord,保持默认优先级,因为它正在被许多其他人测试
urname -r
2.6.32-573.12.1.el6.centos.plus.x86_64

安装supervisord:
sudo yum install supervisor
supervisor.noarch 0:2.1-9.el6

这个版本的 supervisord 的默认优先级是:
cat /etc/init.d/supervisord |grep chkconfig
#chkconfig: - 95 04

在不改变监督者的情况下改变开/关
[gliang@www prima]$ chkconfig --list supervisord
supervisord     0:off   1:off   2:off   3:off   4:off   5:off   6:off
[gliang@www prima]$ sudo chkconfig --level 3 supervisord on
[gliang@www prima]$ sudo chkconfig --level 4 supervisord off

3级的S95几乎是最低优先级,晚启动,先关机
[gliang@www prima]$ ls -ltr /etc/rc3.d/|grep supervisor
lrwxrwxrwx. 1 root root 21 Jan 29 08:02 S95supervisord -> ../init.d/supervisord
[gliang@www prima]$ ls -ltr /etc/rc4.d/|grep supervisor
lrwxrwxrwx. 1 root root 21 Jan 29 08:02 K04supervisord -> ../init.d/supervisord

使用它来列出和查看此级别上所有守护进程的优先级
ls -ltr /etc/rc3.d/

关于nginx - 对于像 supervisord 这样的进程 Controller ,RHEL init.d 脚本中的 chkconfig 行应该设置为什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34889325/

相关文章:

emacs - 如何永久禁用 emacs 站点启动文件?

yum - 相当于 yum 的 apt-get update

java - 运行时的<init>方法

centos - Podman 图像未使用 podman 图像 ls 显示

docker - Gitlab Runner:在其他机器上找不到microdnf/yum命令

java - 连接到 web 服务导致 com.sun.xml.internal.ws.client.ClientTransportException : The server sent HTTP status code 200: OK

docker - 从 docker-compose 替换 NGINX 配置中的环境变量

docker - CloudFoundry:nginx用于在Gunicorn(Docker)之上提供静态内容

tomcat - 带有tomcat(moqui)的Nginx SSL无法稳定地运行带有https地址的moqui

python - 基本 Python 类