Redhat开关机时, Oracle启动和关闭的脚本运行不了?
目的:我想让Red Hat启动和关闭时都运行脚本oracle.bat,使oracle随系统的启动而启动,关闭而关闭。
环境:
1.oracle.bat的创建者:root
2.oracle.bat的路径:/etc/init.d/oracle.bat
3.oracle.bat的硬连接:ln /etc/init.d/oracle.bat /etc/rc3.d/S99oracle
ln /etc/init.doracle.bat /etc/rc0.d/K99oracle
chmod 744 /etc/rc3.d/S99oracle
chmod 744 /etc/rc0.d/K99oracle
chgrp sys /etc/rc3.d/S99oracle
chgrp sys /etc/rc0.d/K99oracle
4./etc/oratab的内容如下:
ORADB:/usr/app/oracle/product/10.1.0/db_1:Y
5.oracle.bat的内容如下:
ORACLE_HOME=/usr/app/oracle/product/10.1.0/db_1
ORACLE_OWNER=oracle
if [ ! -f $ORACLE_HOME/bin/dbstart ]; then
echo "Oracle startup: cannot start Oracle"
exit 1
fi
case "$1" in
'start')
echo "-------------------------------------------------------------------"
echo `date '+%F %T'`" starting oracle database......"
su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/dbstart">>/var/log/orace.log
echo "Done."
echo `date '+%F %T'`" starting oracle listner......"
su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/lsnrctl start">>/var/lo/oracle.log
echo "Done."
;;
'stop')
echo "-------------------------------------------------------------------"
echo `date '+%F %T'`" stoping oracle database......"
su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/dbshut">>/var/log/oracl.log
echo "Done."
echo `date '+%F %T'`" stoping oracle listner......"
su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/lsnrctl stop">>/var/logoracle.log
echo "Done."
;;
'restart')
$0 stop
$0 start
;;
*)
echo "Usage: oracle.bat {start|stop|restart}"
exit 1
esac
exit 0
---------------------------------------------------------------------------------------------------
我在root用户下,用oracle.bat start或oracle.bat stop时都可以启动和关闭Oracle,但是RedHat开关机时却没有运行这个oracle.bat脚本,不知道我错在哪里,请大虾指点,谢谢!