linux sets the tomcat bootstrap method

  • 2020-05-07 20:46:54
  • OfStack

linux set tomcat under centos will start automatically after boot automatically execute/etc/rc local of command, usually start tomcat command to tomcat_home/bin/startup sh or tomcat_home/bin/catalina sh start, when any one to join them directly/etc/rc local, restart the machine after found tomcat did not start. The reason is that the java environment has not been set up when the boot, so I wrote a script, first set the java environment, and then start, the script is as follows:


export JAVA_HOME=/usr/local/jdk1.6.0_30
export PATH=$JAVA_HOME/bin/:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$CLASSPATH
export CATALINA_HOME=/usr/local/tomcat-6.0.35/
/usr/local/tomcat-6.0.35/bin/catalina.sh start

Suppose you save a file named auto-startup.sh under /usr/local/ tomcat-6.0.35 /bin, then add /usr/local/ tomcat-6.0.35 / auto-startup.sh to /etc/ rc.local. Note: auto-startup.sh needs to be set to have execute permissions.


Related articles: