rc.local 是一个系统脚本
该脚本是在系统初始化级别脚本运行之后再执行的,因此可以安全地在里面添加你想在系统启动之后执行的脚本。
查看脚本
cat /etc/rc.local
#!/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