Prerequisite: have installed tomcat
- New service script: vim /etc/init.d/tomcat
previous detours, in fact, is a new tomcat.sh script files in the init.d, I understand tomcat became the new folder in init.d, then catalina.sh copied in - Fill in the following contents in tomcat.sh
#!/bin/bash
# description: Tomcat8 Start Stop Restart
# processname: tomcat8
# chkconfig: 234 20 80
CATALINA_HOME=/usr/local/tomcat
case $1 in
start)
sh $CATALINA_HOME/bin/startup.sh
;;
stop)
sh $CATALINA_HOME/bin/shutdown.sh
;;
restart)
sh $CATALINA_HOME/bin/shutdown.sh
sh $CATALINA_HOME/bin/startup.sh
;;
*)
echo 'please use : tomcat {start | stop | restart}'
;;
esac
exit 0
Note: CATALINA_HOME here to revise their tomcat directory.
- accessible
Service tomcat start Service tomcat stop Service tomcat restart
To start, shut down, restart the operation.
################################################## ########
Note: If the error:
Failed to get properties: Access denied
env: /etc/init.d/tomcat: 权限不够
The tomcat.sh attributes can be updated to Read And Write.
Linux is Zhendi fast start tomcat ,,,