1, vi /etc/rc.d/rc.local (自启动oracle)
touch /var/lock/subsys/local
sh /StartupServer.sh
#echo "Starting Tomcat, pls waiting..."
#JAVA_HOME='/usr/java/j2sdk1.4.2'
#sh /jakarta-tomcat/bin/startup.sh > a.txt
--startupserver.sh
[root@qasvr8165 /]# cat StartupServer.sh
#!/bin/sh
#icount=`pgrep -fl jakarta-tomcat.bin | wc -l`
#if [ $icount = 0 ]
#then
# echo "Newly starting the Tomcat, pls waiting..."
# sh /jakarta-tomcat/bin/startup.sh
# echo "Removing the old compiled class files"
# exit -1;
#fi
#if [ $icount != 0 ]
#then
# echo "Restarting the Tomcat, pls waiting..."
# sh /jakarta-tomcat/bin/shutdown.sh
# echo "Cleaning the old compiled classes"
# sh /jakarta-tomcat/bin/startup.sh
# exit -1;
#fi
echo "Starting Oracle DB, pls waiting..."
su - oracle -c '/home/oracle/product/9.2.0/bin/lsnrctl start'
su - oracle -c '/home/oracle/product/9.2.0/bin/sqlplus "sys/pass@boss as sysdba" <<EOF
startup
EOF'
2, use chkconfig 把下面的shell文件, setup一下,(自启动tomcat)
--tomcat.sh
[root@qasvr8165 init.d]# cat /etc/rc.d/init.d/tomcat
#! /bin/sh
#
# portmap Start/Stop RPC portmapper
#
# chkconfig: 345 13 87
# description: The portmapper manages RPC connections, which are used by /
# protocols such as NFS and NIS. The portmap server must be /
# running on machines which act as servers for protocols which /
# make use of the RPC mechanism.
# processname: portmap
# This is an interactive program, we need the current locale
[ -f /etc/profile.d/lang.sh ] && . /etc/profile.d/lang.sh
# Source function library.
export JAVA_HOME=/usr/local/java/j2sdk1.4.2
CLASSPATH=./:/usr/local/java/j2sdk1.4.2/lib:/usr/local/java/j2sdk1.4.2/jre/lib
CLASSPATH=$CLASSPATH:$ORACLE_HOME/network/jlib
CLASSPATH=$CLASSPATH:$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
export CLASSPATH
start() {
echo -n $"Starting tomcat: "
cd /jakarta-tomcat/bin
./startup.sh
RETVAL=$?
echo
[ $RETVAL -eq 0 ]
return $RETVAL
}
stop() {
echo -n $"Stopping $prog: "
cd /jakarta-tomcat/bin
./shutdown.sh
RETVAL=$?
echo
[ $RETVAL -eq 0 ]
return $RETVAL
}
restart() {
stop
start
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
pgrep -fl tomcat
;;
restart|reload)
restart
;;
*)
echo $"Usage: $0 {start|stop|status|restart|reload|condrestart}"
exit 1
esac
exit $?
应该就okay了.