這篇文章主要為大家詳細(xì)介紹了linux設(shè)置tomcat自啟動的方法,文中示例代碼和步驟介紹的非常詳細(xì),零基礎(chǔ)也能參考此文章,感興趣的小伙伴們可以參考一下。

一、在/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文件權(quán)限
chmod +x /etc/init.d/tomcat
三、配置開機啟動
啟動:service tomcat start
停止:service tomcat stop
重啟:service tomcat restart
chkconfig --add tomcat
chkconfig tomcat on
關(guān)閉tomcat服務(wù)自啟動:chkconfig tomcat off
刪除tomcat服務(wù)在chkconfig上的管理:chkconfig –del tomcat上文描述的就是linux設(shè)置tomcat自啟動的方法,具體使用情況還需要大家自己動手實驗使用過才能領(lǐng)會。如果想了解更多相關(guān)內(nèi)容,歡迎關(guān)注創(chuàng)新互聯(lián)網(wǎng)站制作公司行業(yè)資訊頻道!
分享標(biāo)題:linux如何設(shè)置tomcat自啟動?-創(chuàng)新互聯(lián)
轉(zhuǎn)載注明:http://chinadenli.net/article12/cohjdc.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供虛擬主機、商城網(wǎng)站、域名注冊、微信小程序、網(wǎng)頁設(shè)計公司、網(wǎng)站策劃
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容