chkconfig 添加脚本开机自启动
本站教程收集整理的这篇文章主要介绍了chkconfig 添加脚本开机自启动,本站教程本站觉得挺不错的,现在分享给大家,也给大家做个参考。
1./etc/rc.local? 自启动
2.通过chkconfig管理
如何让一个脚本被chkconfig管理
[[email?protected] ~]# vim /etc/init.d/oldgirld
# chkconfig: 2345 99 99? ##这步必须的 ?vim /etc/init.d/crond 配置中可见
# descriptiON:[XM1]? Saves and restores system entropy pool for \
echo 1
~??
[[email?protected] ~]# chmod +x /etc/init.d/oldgirld? ##给文件加x执行权限
[[email?protected] ~]# chkconfig --add oldgirld? ##添加自启动
[[email?protected] ~]# chkconfig |grep old
oldgirld?????? 0:off?????? 1:off?????? 2:on?????? 3:on?????? 4:on?????? 5:on6:off
翻译
?
RUNLEVEL FILES
?????? Each service which should be manageable by chk-
?????? config? needs two or more commented lines added
?????? to its init.d script. The first line tells chk-
?????? config? what? runlevels? the? service should be
??? ???started in by default,as well as the start and
?????? stop? priority? levels.? If? the service should
?????? not,by default,be started in any runlevels,a
?????? -? should? be? used? in? place of the runlevels
????? ?list.? The second line contains? a? description
?????? for? the? service,? and? may be extended across
?????? multiple lines with BACkslash conTinuation.
?
?????? For example,random.init has these three lines:
?? ????# chkconfig: 2345 20 80
?????? # description: Saves and restores system entropy pool for \
?????? #????????????? higher quality random number generation.
?????? This? says? that? the? random? script should be
?????? started in levels 2,3,? 4,? and? 5,? that? its
?????? start? priority should be 20,and that its stop
?????? priority should be 80.? You should be? able? to
?????? figure? out? what? the? description says; the \
?????? causes the line to? be? conTinued.?? The? extra
?????? space in front of the line is ignored.
译:
RUNLEVEL文件每个服务应该由chkconfig管理,chkconfig需要添加到init.d脚本中的两个或更多注释行。第一行告诉chkconfig默认应该在什么运行级别启动服务,以及启动和停止优先级级别。在任何运行级别中,都应该使用a-来代替runlevel列表。通过反斜杠的延续。例如,Rand.init有以下三行:#chkconfig:2345 20 80#Description:保存和恢复系统熵池以提高质量\#随机数生成。这意味着随机脚本应该在级别2、3、4和5中启动,它的开始优先级应该是20,它的停止优先级应该是80。你应该能够弄清楚描述中写了什么;\导致行被继续。该行前面的额外空间被忽略了。
?
# chkconfig: 2345 20 80
# description: Saves and restores system entropy pool for \
# higher quality random number generation.
使用范例:
chkconfig --list #列出所有的系统服务
chkconfig --add httpd #增加httpd服务
chkconfig --del httpd #删除httpd服务
chkconfig --level httpd 2345 on #设置httpd在运行级别为2、3、4、5的情况下都是on(开启)的状态
chkconfig --list #列出系统所有的服务启动情况
chkconfig --list MysqLd #列出MysqLd服务设置情况
chkconfig --level 35 MysqLd on #设定MysqLd在等级3和5为开机运行服务,--level 35表示操作只在等级3和5执行,on表示启动,off表示关闭
chkconfig MysqLd on #设定MysqLd在各等级为on,“各等级”包括2、3、4、5等级
如何增加一个服务:
1.服务脚本必须存放在/etc/ini.d/目录下;
2.chkconfig --add servicename
在chkconfig工具服务列表中增加此服务,此时服务会被在/etc/rc.d/rcN.d中赋予K/S入口了; 3.chkconfig --level 35 MysqLd on
修改服务的默认启动等级。
?[XM1]说明,注释
本站总结
以上是本站教程为你收集整理的chkconfig 添加脚本开机自启动全部内容,希望文章能够帮你解决chkconfig 添加脚本开机自启动所遇到的程序开发问题。
如果觉得本站教程网站内容还不错,欢迎将本站教程推荐给好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。
《chkconfig 添加脚本开机自启动》来自互联网同行内容,若有侵权,请联系我们删除!
相关文章
发表评论
评论列表
- 这篇文章还没有收到评论,赶紧来抢沙发吧~