yum -y install suerpvisor
设置开机自启
systemctl enable supervisor.service
这是几个常用的supervisorctl的命令
supervisorctl status
supervisorctl stop tomcat
supervisorctl start tomcat
supervisorctl restart tomcat
supervisorctl reread
supervisorctl update
tar -zxvf jdk-8u60-linux-x64.tar.gz -C /usr/local/
chown -R root.root /usr/local/jdk1.8.0_60
cat>>/etc/profile<<\EOF
###jdk环境###
export JAVA_HOME=/usr/local/jdk1.8.0_60
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
export CLASSPATH=.$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$JAVA_HOME/lib/tools.jar
EOF
source /etc/profile
java -version
这里tomcat安装包用8.5代替
tar -zxvf apache-tomcat-8.5.29.tar.gz
mkdir -p /opt/app01
cp -a apache-tomcat-8.5.29/* /opt/app01/
ps-ef |grep java
我们在app01 文件夹下输入 “./bin/startup.sh”
然后我们启动supervisord.service
systemctl start supervisord.service
打开网址输入我们的ip加上端口号
页面是tomcat的页面
在/etc/supervisord.d/下建立一个app01.ini这么一个文件
[program:app01]
command=/opt/app01/bin/catalina.sh run
environment=JAVA_HOME="/usr/local/jdk1.8.0_60",JAVA_BIN="/usr/local/jdk1.8.0_60/bin"
directory=/opt/app01/bin/
numprocs=1
user = root
autostart = true
autorestart=true
startsecs = 5
复制上面这一段话粘贴到你的文件里面进行保存
在启动supervisord.service
输入supervisorctl status
查看app01 是否启动,如没有启动 请输入supervisord stop app01
从新启动一下
即可完成