作者:M海枯石烂想你 | 来源:互联网 | 2023-07-01 17:50
[root@node2system]#catlibsystemdsystemtomcat.service[Unit]DescriptionTomcatAftersyslog.tar
[root@node2 system]# cat /lib/systemd/system/tomcat.service
[Unit]
Description=Tomcat
After=syslog.target network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
EnvirOnment="JAVA_HOME=/usr/local/jdk"
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
systemctl daemon-reload
systemctl stop/start/restart/status tomcat.service
如果不能直接启动
tomcat配置pid
vim ../tomcat/bin/catalina.sh
此位置添加 CATALINA_PID="$CATALINA_BASE/tomcat.pid"
重新执行以上命令