[Email protected] ~]# cd/etc/rc.d/[email protected] rc.d]# Cat rc.local #!/bin/sh## This script would be executed*after*All the other init scripts.# You can put your own initialization stuffinchHereifYou don'T# Want to DoThe full Sys V style init Stuff.touch/var/Lock/subsys/local#./doc/redis-3.0.4/src/redis-server/doc/redis-3.0.4/redis.conf Export Java_home=/usr/local/java/jdk1.7.0/usr/local/tomcat/apache-tomcat-7.0. +/bin/startup.sh start[[email protected] rc.d]#
Parsing rc.local files
1. Configure Environment variables
Export Java_home=/usr/local/java/jdk1. 7.0 (JDK installation directory can be obtained with $echo $JAVA _home) Here's how my server looks for java_home environment variables [[email protected] rc.d]# $echo $JAVA _home-bash: /usr/local/java/jdk1. 7.0 is a directory
2. Configure the Tomcat path
/usr/local/tomcat/apache-tomcat-7.0.62/bin/startup.sh Start
This is the startup.sh location path of the Tomcat Web server plus start
3. Save the file
Press ESC and ENTER: Wq we've saved the rc.local input right now.
4. Modify the rc.local file to be executable, such as: chmod +x rc.local
5. Restart your server
Shutdown-r now
6. After the power-on login to execute
Ps-ef|grep Java
Value after the login whether there is a Java process if there is OK
[Email protected] rc.d]# ps-ef|grep java
Root 1102 1 0 16:19? 00:00:04/usr/local/java/jdk1.7.0/bin/java-djava.util.logging.config.file=/usr/local/tomcat/ Apache-tomcat-7.0.62/conf/logging.properties-djava.util.logging.manager=org.apache.juli.classloaderlogmanager- djava.endorsed.dirs=/usr/local/tomcat/apache-tomcat-7.0.62/endorsed-classpath/usr/local/tomcat/ Apache-tomcat-7.0.62/bin/bootstrap.jar:/usr/local/tomcat/apache-tomcat-7.0.62/bin/tomcat-juli.jar- dcatalina.base=/usr/local/tomcat/apache-tomcat-7.0.62-dcatalina.home=/usr/local/tomcat/apache-tomcat-7.0.62- Djava.io.tmpdir=/usr/local/tomcat/apache-tomcat-7.0.62/temp org.apache.catalina.startup.Bootstrap start Start
Root 1187 1005 0 16:28 pts/1 00:00:00 grep java
Linux Setup tomcat boot up