为了解决一个未知的问题,我们通常分为3步,了解当前正在做什么,当前所做的为什么会引起问题,解决问题。那么现在,我们需要知道的是root.sh这个脚本正在做什么,执行到了哪里。
使用"ps -ef | grep root.sh"命令,找到root.sh的pid,然后再寻找这个pid的子进程,一直定位到最末端,发现当前正在运行的命令是"sleep 60",而"sleep 60"的上级命令是"init.cssd startcheck CSS"。
root.sh的核心其实在于$ORA_CRS_HOME/install/rootconfig这个脚本,在这个文件中,我们根据上述线索,找到下面的代码:
# Prepare to start the daemons. $ID/init.crs start # Check to see if they are going to start. $ID/init.cssd startcheck CSS if [ "$?" != "0" ]; then $ECHO CRS daemons not set to start. See $MSGFILE for details. exit 1 fi
实际上运行root.sh的输出中的"Startup will be queued to init within 30 seconds.",正是init.crs start的显示。从root.sh当前运行的子进程来看,目前正在运行"$ID/init.cssd startcheck CSS"这一命令。所以接下来我们需要知道在这一个命令里面会一直挂起。
在HP-UX操作系统中,init.cssd在/sbin/init.d目录下,我们可以发现init.cssd也是一个比较复杂的脚本。为了搞清楚一个shell脚本执行到了哪里出了问题,我们可以使用sh -x以调试方式运行shell脚本。(实际上在分析root.sh当前正在进行的操作时,我们同样可以用sh -x ./root.sh这样的命令来运行。)
我们手工执行如下的命令:
cd /sbin/init.d sh -x init.cssd startcheck CSS
然后发现在下面的代码中32-37行代码处挂起:
# check on vendor clusterware and filesystem dependencies. # Startcheck is supposed to block for a long time waiting on dependencies. 'startcheck') # Returns 0 if we should start # Returns 1 on a non-cluster boot # Returns 2 if disabled by admin # Returns 3 on error # Check our startup run status, initialized by the automatic startup # or manual startup routes. $ID/init.cssd runcheck STATUS=$? if [ "$STATUS" != "0" ]; then exit $STATUS; fi # If we have vendor clusterware, and CLINFO indicates a non-clustered boot # then prevent CRS startup. if [ $USING_VC -eq 1 ] then # Run CLINFO to get cluster status. It returns 0 if the machine is # booting in clustered mode. $EVAL $CLINFO if [ "$?" != "0" ]; then $LOGMSG "Oracle Cluster Ready Services disabled by non-clustered boot." $ID/init.cssd norun exit 1; fi # Wait for the Vendor Clusterware to start $EVAL $VC_UP RC=$? while [ $RC -ne 0 ]; do $LOGMSG "Oracle Cluster Ready Services waiting for $VC_NAME to start." $SLEEP $DEP_CHECK_WAIT $EVAL $VC_UP RC=$? done fi
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-30053-12.html
还好输了
不清楚生产环境和流程
米涨价了