CentOS 7 服务器配置--配置Tomcat开机启动
#编辑Tomcat的文件,追加内容
vi /data/tomcat/apache-tomcat-8.0.43/bin/catalina.sh
#追加内容,在CLASSPATH= 上面的第三行
CATALINA_PID="$CATALINA_BASE/tomcat.pid"
#在/usr/lib/systemd/system添加tomcat.service文件
vi /usr/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=/data/Java/jdk1.8.0_121"
PIDFile=/data/tomcat/apache-tomcat-8.0.43/tomcat.pid
ExecStart=/data/tomcat/apache-tomcat-8.0.43/bin/starup.sh
ExecReload=/bin/kill -s HUP $MAINPID
ExceStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
#配置Tomcat开机启动
systemctl enable tomcat 开机启动
systemctl status tomcat 查看状态
systemctl start / stop / restart tomcat 开始/停止/重启 tomcat