linux tomcat自啓動配置

一、在/etc/init.d/下新建tomcat文件
vim /etc/init.d/tomcat
寫入如下腳本
#!/bin/bash
#description:  start stop restart
#processname: Tomcat
#chkconfig: 234 20 80
export JAVA_HOME=/usr/local/java
CATALINA_HOME=/usr/local/tomcat-xxxxx
case  $1 in 
              start)
                     sh $CATALINA_HOME/bin/startup.sh
                     ;;
              stop)
                     sh $CATALINA_HOME/bin/shutdown.sh
                     ;;
            restart)
                     sh $CATALINA_HOME/bin/shutdown.sh
                     sh $CATALINA_HOME/bin/startup.sh
                     ;;
                  *)
                                   echo 'please use: tomcat {start | stop | restart}'
                     ;;                  
esac
exit 0
二、賦予tomcat文件權限
chmod +x /etc/init.d/tomcat
三、配置開機啓動
啓動:service tomcat start
停止:service tomcat stop
重啓:service tomcat restart
chkconfig --add tomcat
chkconfig tomcat on
關閉tomcat服務自啓動:chkconfig tomcat off
刪除tomcat服務在chkconfig上的管理:chkconfig –del tomcat


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章