Centos7开机启动tomcat8
1、添加开机启动文件
进入/usr/lib/systemd/system目录
vi tomcat.service
[Unit]
Description=Tomcat
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/apache-tomcat-8.5.65/bin/startup.sh
ExecStop=/usr/local/apache-tomcat-8.5.65/bin/shutdown.sh
PrivateTmp=true
[Install]
WantedBy=multi-user.target
注意:Tomcat的绝对安装目录
给脚本赋权限:chmod +x /lib/systemd/system/tomcat.service
重新加载systemd的守护线程:systemctl daemon-reload
授权tomcat开机启动: systemctl enable tomcat.service
2、管理服务
systemctl start tomcat 启动tomcat服务
systemctl stop tomcat 停止tomcat服务
systemctl restart tomcat 重启tomcat服务
systemctl status tomcat 查看状态