Linux configuration tomcat into service

Prerequisite: have installed tomcat
  1. 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
  2. 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.

  1. 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.
Here Insert Picture Description

Linux is Zhendi fast start tomcat ,,,

Published 25 original articles · won praise 5 · views 20000 +

Guess you like

Origin blog.csdn.net/sinse_/article/details/104705234