supervisor 安裝(本文在ubuntu下安裝)
配置阿里云源
root@bogon:/etc/apt# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 15.10
Release: 15.10
Codename: wily
顯示了一些ubuntu的版本信息您没,需要得到的是Codename塑径,比如,我這里是wily
查看:http://mirrors.aliyun.com/help/ubuntu
deb http://mirrors.aliyun.com/ubuntu/ quantal main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ quantal-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ quantal-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ quantal-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ quantal-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ quantal main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ quantal-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ quantal-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ quantal-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ quantal-backports main restricted universe multiverse
上面quantal 替換為Codename中:wily
root@bogon:/etc/apt# mv sources.list sources.list_bak
root@bogon:/etc/apt# vi sources.list #添加下面內(nèi)容
deb http://mirrors.aliyun.com/ubuntu/ wily main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ wily-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ wily-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ wily-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ wily-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ wily main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ wily-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ wily-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ wily-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ wily-backports main restricted universe multiverse
阿里云源配置完畢
install supervisor
- apt-get install supervisor
- 配置supervisor.conf
vi supervisor.conf
[include]
files = /etc/supervisor/conf.d/*.conf #此*.conf是需要被管理進(jìn)程配置文件
- 配置被管理進(jìn)程
cd /etc/supervisor/conf.d/
vi test.conf
[program:test] #進(jìn)行名稱
dirctory=/home/aapon/abs_tomcat/bin #目錄
environment=JAVA_HOME="/home/aapon/tomcat/jdk1.7.0_75",JAVA_BIN="/home/aapon/tomcat/jdk1.7.0_75/bin" #java環(huán)境變量
command=/home/aapon/abs_tomcat/bin/startup.sh run #啟動(dòng)命令
autostart=true #在supervisord啟動(dòng)的時(shí)候也自動(dòng)啟動(dòng)
startsecs=5 #啟動(dòng)10秒后沒(méi)有異常退出漾抬,就表示進(jìn)程正常啟動(dòng)了盈简,默認(rèn)為1秒
autorestart=true #程序退出后自動(dòng)重啟
startretries=3 #啟動(dòng)失敗自動(dòng)重試次數(shù),默認(rèn)是3
user=test #用什么用戶啟動(dòng)
supervisor 啟動(dòng)命令
- 啟動(dòng)supervisor服務(wù) 進(jìn)程 sudo supervisord -c /etc/supervisor/supervisor.conf
-
啟動(dòng)進(jìn)程
supervisor 管理tomcat進(jìn)程過(guò)程遇到的坑
- 使用 supervisord 監(jiān)控管理的進(jìn)程必須以 nodaemon 啟動(dòng)携取,而 tomcat 的 startup.sh 腳本是daemon方式的攒钳,如果不做修改的話,supervisord 會(huì)一直報(bào)錯(cuò)
在 startup.sh 的最后的
exec "$PRGDIR"/"$EXECUTABLE" start "$@" 改為
exec "$PRGDIR"/"$EXECUTABLE" run "$@"
--------------------------------------------我是分割線---------------------------------
第一篇文章雷滋,這是在一位小朋友建議下寫簡(jiǎn)書(shū)文檔夕玩,之前都是寫到某道筆記上,以后會(huì)把自己寫的文章惊豺,都放到簡(jiǎn)書(shū)上燎孟,希望對(duì)大家有幫助。