最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

CentOS7 增加tomcat 啟動(dòng)、停止(使用systemctl進(jìn)行配置)

  發(fā)布時(shí)間:2015-11-02 16:22:29   作者:佚名   我要評(píng)論
這篇文章主要介紹了CentOS7 增加tomcat 啟動(dòng)、停止(使用systemctl進(jìn)行配置),需要的朋友可以參考下
1,centos7 使用 systemctl 替換了 service命令
參考:redhat文檔:
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/System_Administrators_Guide/sect-Managing_Services_with_systemd-Services.html#sect-Managing_Services_with_systemd-Services-List

查看全部服務(wù)命令:
systemctl list-unit-files --type service
查看服務(wù)
systemctl status name.service
啟動(dòng)服務(wù)
systemctl start name.service
停止服務(wù)
systemctl stop name.service
重啟服務(wù)
systemctl restart name.service增加開機(jī)啟動(dòng)
systemctl enable name.service
刪除開機(jī)啟動(dòng)
systemctl disable name.service
其中.service 可以省略。


2,tomcat增加啟動(dòng)參數(shù)
tomcat 需要增加一個(gè)pid文件
在tomca/bin 目錄下面,增加 setenv.sh 配置,catalina.sh啟動(dòng)的時(shí)候會(huì)調(diào)用,同時(shí)配置java內(nèi)存參數(shù)。


復(fù)制代碼
代碼如下:

#add tomcat pid
CATALINA_PID="$CATALINA_BASE/tomcat.pid"
#add java opts
JAVA_OPTS="-server -XX:PermSize=256M -XX:MaxPermSize=1024m -Xms512M -Xmx1024M -XX:MaxNewSize=256m"


3,增加tomcat.service

在/usr/lib/systemd/system目錄下增加tomcat.service,目錄必須是絕對(duì)目錄。


復(fù)制代碼
代碼如下:

[Unit]
Description=Tomcat
After=syslog.target network.target remote-fs.target nss-lookup.target

[Service]
Type=forking
PIDFile=/data/tomcat/tomcat.pid
ExecStart=/data/tomcat/bin/startup.sh
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true

[Install]
WantedBy=multi-user.target


[unit]配置了服務(wù)的描述,規(guī)定了在network啟動(dòng)之后執(zhí)行。[service]配置服務(wù)的pid,服務(wù)的啟動(dòng),停止,重啟。[install]配置了使用用戶。

4,使用tomcat.service
配置開機(jī)啟動(dòng)

systemctl enable tomcat


啟動(dòng)tomcat
systemctl start tomcat
停止tomcat
systemctl stop tomcat
重啟tomcat
systemctl restart tomcat


因?yàn)榕渲胮id,在啟動(dòng)的時(shí)候會(huì)再tomcat根目錄生成tomcat.pid文件,停止之后刪除。

同時(shí)tomcat在啟動(dòng)時(shí)候,執(zhí)行start不會(huì)啟動(dòng)兩個(gè)tomcat,保證始終只有一個(gè)tomcat服務(wù)在運(yùn)行。

多個(gè)tomcat可以配置在多個(gè)目錄下,互不影響。

相關(guān)文章

最新評(píng)論

海林市| 惠州市| 五家渠市| 宁远县| 南丹县| 五大连池市| 蓝田县| 阿巴嘎旗| 光山县| 甘孜县| 淳安县| 黎川县| 临清市| 同心县| 米林县| 资阳市| 垣曲县| 青铜峡市| 孙吴县| 峨眉山市| 合川市| 三原县| 西乌珠穆沁旗| 三台县| 叙永县| 财经| 珠海市| 宁都县| 大连市| 莱阳市| 永靖县| 宜阳县| 宁蒗| 礼泉县| 泾源县| 南京市| 青龙| 荔波县| 宁强县| 红原县| 宜城市|