CentOS7配置Tomcat8开机自动启动

1、创建文件

# vi /etc/systemd/system/tomcat.service

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

[Service]
Type=oneshot
ExecStart=/usr/local/apache-tomcat-8.5.40/bin/startup.sh
ExecStop=/usr/local/apache-tomcat-8.5.40/bin/shutdown.sh
ExecReload=/bin/kill -s HUP $MAINPID
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

2、进入目录

# cd /etc/systemd/system/

3、设置开机启动

# systemctl enable tomcat

查询当前tomcat的状态:

# systemctl status tomcat

关闭tomcat:

# systemctl stop tomcat

关闭开机自启:

# systemctl disable tomcat

 

CentOS7 安装 Tomcat8

posted @ 2019-05-02 21:59  威流  阅读(9919)  评论(0编辑  收藏  举报