rc.local 是一個系統腳本java
該腳本是在系統初始化級別腳本運行以後再執行的,所以能夠安全地在裏面添加你想在系統啓動以後執行的腳本。vim
cat /etc/rc.localtomcat
#!/bin/sh # # This script will be executed *after* all the other init scripts. # You can put your own initialization stuff in here if you don't # want to do the full Sys V style init stuff. touch /var/lock/subsys/local export JAVA_HOME="/usr/java/jdk1.7.0_79" export CLASSPATH=".:${JAVA_HOME}/lib:${JAVA_HOME}/lib/tools.jar" export PATH=${JAVA_HOME}/bin:$PATH #tomcat 1 /etc/init.d/tomcat start #tomcat 2 /opt/tomcat/bin/catalina.sh start
vim /etc/rc.local安全