vi /etc/systemd/system/tomcat.service
添加内容
[Unit]
Description=Tomcat8
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
cd /etc/systemd/system/
systemctl enable tomcat.service
systemctl status tomcat.service
systemctl disable tomcat.service
vi /usr/local/apache-tomcat-8.5.40/bin/catalina.sh
export JAVA_HOME=/usr/local/jdk8
export JRE_HOME=/usr/local/jdk8/jre
/usr/local/apache-tomcat-8.5.40/bin/startup.sh
crontab -e
@reboot /usr/local/auto_run.sh
保存即可
reboot