support postscripts return status on ubuntu

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@15031 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
xq2005 2013-02-01 08:17:57 +00:00
parent 80b9c0f06d
commit a1b47e3ed1

View File

@ -109,6 +109,8 @@ export PATH=/xcatpost:$PATH
# use the run_ps subroutine to run the postscripts
TMP=`sed "/postscripts-start-here/,/postscripts-end-here/ s/\(.*\)/run_ps \1/;s/run_ps\s*#/#/;s/run_ps\s*$//" /xcatpost/mypostscript`
echo "
# global value to store the running status of the postbootscripts,the value is non-zero if one postbootscript failed
return_value=0
# subroutine used to run postscripts
run_ps () {
logdir=\"/var/log/xcat\"
@ -120,8 +122,13 @@ run_ps () {
#./\$@ 2>&1 1> /tmp/tmp4xcatlog
#cat /tmp/tmp4xcatlog | tee -a \$logfile
./\$@ 2>&1 | tee -a $logfile
ret_local=\${PIPESTATUS[0]}
if [ \"\$ret_local\" -ne \"0\" ]; then
return_value=\$ret_local
fi
else
echo "\"\`date\` Postscript \$1 does NOT exist.\"" | tee -a \$logfile
return_value=-1
fi
}
# subroutine end