centos – chkconfig使用错误的顺序创建服务符号链接

前端之家收集整理的这篇文章主要介绍了centos – chkconfig使用错误的顺序创建服务符号链接前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
在RHEL 6.3上,我有一个系统服务应该在 postgresql和httpd(分别是64和85)之后启动,但是chkconfig总是把它放在50号.我在CentOS 6.0虚拟机上尝试了一个实验来确保我理解LSB节语法.

我用这个文本创建了/etc/init.d/foo,所有者root,权限755:

### BEGIN INIT INFO
# Provides: foo
# required-Start: postgresql httpd
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Description: Foo init script
### END INIT INFO

然后运行chkconfig –add foo.结果:/ etc / rc5.d / S86foo已按预期创建. (其他运行级别也如预期的那样.)

我在RHEL机器上重复了完全相同的实验,它创建了/etc/rc5.d/S50foo.我看不出两者之间会有什么不同会导致不同的结果.两台机器都有postgresql和httpd,从相同的订单和运行级别开始.有什么想法吗?我可以使用#chkconfig:2345 86 50,或者手动将服务符号链接重命名为正确的顺序,但是我正在尝试为后来的用户记录安装过程,我想知道如何正确操作并理解为什么它是没有按预期工作.

在RH系统上,您必须使用chkconfig行,如下所示:

https://fedoraproject.org/wiki/Packaging:SysVInitScript#.23_chkconfig:_line

关于chkconfig行:

The chkconfig: line in a SysV-style initscript is used to determine
the runlevels in which the service should be started by default. It is
also used to set the “priority”,or order in which the services are
started within a runlevel. All Fedora SysV-style initscripts must have
this line.

关于LSB标题

Each Fedora SysV-style initscript which needs to start by default in
any runlevel must include this line in the LSB Header,and it must
match
the list of runlevels defined for startup in the Chkconfig header.

原文链接:https://www.f2er.com/centos/373444.html

猜你在找的CentOS相关文章