我有一個腳本A調用腳本G。內部腳本G我無法更改任何內容(不具有寫權限)。如何停止從腳本中退出?
腳本內G:
ExitProcess()
{
case $1 in
"0") echo "$0: Finished successfully."
exit 0
;;
*) echo "$0: Unknown return status ($1)"
exit $1
;;
esac
}
由於我是從腳本A退出,如何停止?
腳本A:
check_status()
{
UserName="sbrk6"
MachineName="sn26"
Tstatus=`ssh -f -T ${UserName}@${MachineName} ps -ef | grep -w "Manager 1 PR" | egrep -v "grep|less|vi|more"`
Cstatus=`ssh -f -T ${UserName}@${MachineName} ps -ef | grep -w "gt1" | egrep -v "grep|less|vi|more"`
if [ "$Tstatus" ]
then
if [ "$Cstatus" ]
then
Gstatus=`ps -ef | grep -w "Gth_Hndl" | egrep -v "grep|less|vi|more"`
if [ -z "$Gstatus" ]
then
genth_start
fi
fi
else
if [ -z "$Tstatus" ]
then
if [ -z "$Cstatus" ]
then
Gstatus=`ps -ef | grep -w "Ghfdjdjd" | egrep -v "grep|less|vi|more"`
if [ "$Gstatus" ]
then
genth_stop
fi
fi
fi
fi
}
genth_start()
{
echo START
. GD1_Sh
}
genth_stop()
{
echo STOP
. G_Sh
##This is the Script G ###
}
while :
do
check_status
done
想這而循環繼續下去,直到我殺了這個劇本
我沒有對在腳本(A)中調用的腳本(G)的權限。 – Kimi 2011-01-23 22:47:27
編輯答案包括誘捕退出代碼 – Bryan 2011-01-23 22:54:28