d /usr/lib/systemd/system touch tomcat.service chmod 777 tomcat.service vi tomcat.service [Unit]Description=Tomcat8540After=syslog.target network.target remote-fs.target nss-lookup.target[Service]Type=oneshotExecStart=/usr/local/tomcat8/apache-tomcat-8.5.43/bin/startup.shExecStop=/usr/local/tomcat8/apache-tomcat-8.5.43/bin/shutdown.shExecReload=/bin/kill -s HUP $MAINPIDRemainAfterExit=yes[Install]WantedBy=multi-user.target3、设置开机启动systemctl enable tomcat#重启linux reboot查询当前tomcat的状态:systemctl status tomcat#关闭tomcat:systemctl stop tomcat#关闭开机自启:systemctl disable tomcat
来源:https://www.cnblogs.com/SunshineKimi/p/11373250.html