supervisor开机自启动方法
生活随笔
收集整理的這篇文章主要介紹了
supervisor开机自启动方法
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
配置service類型服務
1 #!/bin/bash 2 # 3 # supervisord This scripts turns supervisord on 4 # 5 # Author: Mike McGrath <mmcgrath@redhat.com> (based off yumupdatesd) 6 # 7 # chkconfig: - 95 04 8 # 9 # description: supervisor is a process control utility. It has a web based 10 # xmlrpc interface as well as a few other nifty features. 11 # processname: supervisord 12 # config: /etc/supervisor/supervisord.conf 13 # pidfile: /var/run/supervisord.pid 14 # 15 16 # source function library 17 . /etc/rc.d/init.d/functions 18 19 RETVAL=0 20 21 start() { 22 echo -n $"Starting supervisord: " 23 daemon "/usr/local/bin/supervisord -c /etc/supervisor/supervisord.conf " 24 RETVAL=$? 25 echo 26 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/supervisord 27 } 28 29 stop() { 30 echo -n $"Stopping supervisord: " 31 killproc supervisord 32 echo 33 [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/supervisord 34 } 35 36 restart() { 37 stop 38 start 39 } 40 41 case "$1" in 42 start) 43 start 44 ;; 45 stop) 46 stop 47 ;; 48 restart|force-reload|reload) 49 restart 50 ;; 51 condrestart) 52 [ -f /var/lock/subsys/supervisord ] && restart 53 ;; 54 status) 55 status supervisord 56 RETVAL=$? 57 ;; 58 *) 59 echo $"Usage: $0 {start|stop|status|restart|reload|force-reload|condrestart}" 60 exit 1 61 esac 62 63 exit $RETVAL?
將上述腳本內容保存到/etc/rc.d/init.d/supervisor文件中,修改文件權限為755,并設置開機啟動
chmod 755 /etc/rc.d/init.d/supervisor chkconfig supervisor on注意:修改腳本中supervisor配置文件路徑為你的supervisor的配置文件路徑
Supervisor只能管理非daemon的進程,也就是說Supervisor不能管理守護進程。否則提示Exited too quickly (process log may have details)異常。例子中的Tomcat默認是以守護進程啟動的,所以我們改成了catalina.sh run,以前臺進程的方式運行。
來源:http://blog.csdn.net/xyang81/article/details/51555473
轉載于:https://www.cnblogs.com/shengulong/p/7641069.html
總結
以上是生活随笔為你收集整理的supervisor开机自启动方法的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: [转载] 全方位提升网站打开速度:前端、
- 下一篇: iOS应用如何支持IPV6