运行:
$:sudo vi /etc/init.d/tomcat8
添加如下:
#!/bin/sh
# description: Auto-starts tomcat
# processname: tomcat
case $1 in
start)
sh $HOME/JAVA-Development/SERVER/apache-tomcat-8.0.36/bin/startup.sh
;;
stop)
sh $HOME/JAVA-Development/SERVER/apache-tomcat-8.0.36/bin/shutdown.sh
;;
restart)
sh $HOME/JAVA-Development/SERVER/apache-tomcat-8.0.36/bin/startup.sh
sh $HOME/JAVA-Development/SERVER/apache-tomcat-8.0.36/bin/shutdown.sh
;;
esac
exit 0
给执行权限chmod 755
OK
$:/etc/init.d/tomcat8 restart
说明:替换tomcat路径即可。