免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1671 | 回复: 0
打印 上一主题 下一主题

用chkconfig来启动添加服务 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-12-22 15:55 |只看该作者 |倒序浏览
1.在/etc/init.d服务名字  touch /etc/init.d/servicename
2.建立开机关机时启动的优先级 链接
ln -s /etc/init.d/servername /etc/rc.d/rc0.d/K20servername
ln -s /etc/init.d/servername /etc/rc.d/rc3.d/S80servername
3.填写脚本内容
#vi /etc/init.d/servername 如下:
#!/bin/sh
#chkconfig 2345 20 80 #(分别为系统runleavel,开机时的priority,关机时的priotiry)
#description: (Write whatever you want!)写上服务的描述。注意:可以不写,但不必须有这一项。
case $1 in      
          start)            sh /DIR/servicename #(需要启动服务的脚本路径)            ;;     
          stop)            sh /DIR/servicename #(需要关闭服务的脚本路径)            ;;      
              *)        ;;
           esac
4. 改变访问权限  chmod 755 /etc/init.d/servicename
5.添加服务    chkconfig --add servername
6.验证一下吧。    chkconfig --list|grep servername    reboot 你的机器。完成。
               
               
               

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u3/106583/showart_2128097.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP