我用这个文本创建了/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,或者手动将服务符号链接重命名为正确的顺序,但是我正在尝试为后来的用户记录安装过程,我想知道如何正确操作并理解为什么它是没有按预期工作.
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.