设为首页收藏本站

ZMX - IT技术交流论坛 - 无限Perfect,追求梦想 - itzmx.com

 找回密码
 注册论坛

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

用百度帐号登录

只需两步,快速登录

搜索
查看: 1734|回复: 0

linux下 kangle 开机自动启动 /etc/init.d/kangle chkconfig启动项service系统服务注册

[复制链接]
 成长值: 255

签到天数: 4710 天

[LV.Master]伴坛终老

发表于 2018/3/12 05:02 | 显示全部楼层 |阅读模式 |Google Chrome 65.0.3325.146|Windows 10
天涯海角搜一下: 百度 谷歌 360 搜狗 有道 雅虎 必应 即刻
有时候遇到某家openvz虚拟化的/etc/rc.d/rc.local文件启动不管用,怎么折腾都不行,估计是母鸡坏了
那就使用chkconfig 方式来开机启动kangle
  1. vi /etc/init.d/kangle
复制代码
  1. #!/bin/bash
  2. #
  3. # kangle        Startup script for the Apache HTTP Server
  4. #
  5. # chkconfig: - 85 15
  6. # description: Apache is a World Wide Web server.  It is used to serve \
  7. #               HTML files and CGI.
  8. # processname: kangle
  9. # config: /etc/kangle/conf/kangle.conf
  10. # config: /etc/sysconfig/kangle
  11. # pidfile: /var/run/kangle.pid

  12. # Source function library.
  13. . /etc/rc.d/init.d/functions


  14. KANGLE_LANG=${HTTPD_LANG-"C"}

  15. # This will prevent initlog from swallowing up a pass-phrase prompt if
  16. # mod_ssl needs a pass-phrase from the user.
  17. INITLOG_ARGS=""

  18. # Set HTTPD=/usr/sbin/kangle.worker in /etc/sysconfig/kangle to use a server
  19. # with the thread-based "worker" MPM; BE WARNED that some modules may not
  20. # work correctly with a thread-based MPM; notably PHP will refuse to start.

  21. # Path to the apachectl script, server binary, and short-form for messages.
  22. prog=kangle
  23. pidfile=${PIDFILE-/vhs/kangle/var/kangle.pid}
  24. RETVAL=0

  25. # The semantics of these two functions differ from the way apachectl does
  26. # things -- attempting to start while running is a failure, and shutdown
  27. # when not running is also a failure.  So we just do it the way init scripts
  28. # are expected to behave here.
  29. start() {
  30.         echo -n $"Starting $prog: "
  31.         LANG=$HTTPD_LANG
  32.         ulimit -n 51200
  33.         /vhs/kangle/bin/kangle
  34.         RETVAL=$?
  35.         echo
  36.         [ $RETVAL = 0 ]
  37.         return $RETVAL
  38. }
  39. # When stopping kangle a delay of >10 second is required before SIGKILLing the
  40. # kangle parent; this gives enough time for the kangle parent to SIGKILL any
  41. # errant children.
  42. stop() {
  43.         echo -n $"Stopping $prog: "
  44.         /vhs/kangle/bin/kangle -q
  45. }
  46. restart() {
  47.         echo -n $"Restarting $prog: "
  48.         stop
  49.         start
  50. }

  51. # See how we were called.
  52. case "$1" in
  53.   start)
  54.         start
  55.         ;;
  56.   stop)
  57.         stop
  58.         ;;
  59.   restart)
  60.         stop
  61.         start
  62.         ;;
  63.   reload)
  64.         reload
  65.         ;;
  66.   *)
  67.         echo $"Usage: $prog {start|stop|restart}"
  68.         exit 1
  69. esac

  70. exit $RETVAL
复制代码

给予权限
  1. chmod +x /etc/init.d/kangle
复制代码
然后注册下启动服务
  1. chkconfig --level 35 kangle on
复制代码

chkconfig --list 查看Linux开机启动项列表

reboot重启,发现还是不能正常启动kangle,ok,换商家吧,或者手动启动下

然后也可以用下面命令来管理kangle重启
service kangle restart

欢迎光临IT技术交流论坛:http://bbs.itzmx.com/
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册论坛 新浪微博账号登陆用百度帐号登录

本版积分规则

手机版|Archiver|Mail me|网站地图|IT技术交流论坛 ( 闽ICP备13013206号-7 )

GMT+8, 2024/11/26 02:55 , Processed in 0.123252 second(s), 19 queries , MemCache On.

Powered by itzmx! X3.4

© 2011- sakura

快速回复 返回顶部 返回列表