Menu

#4752 setupntp has problem to run in sh -x

2.11
open
yangsong
None
postscripts
5
2015-07-16
2015-07-16
No

Today we found an issue that when run setupntp postscript with '-x' option, the code in following part would fail. The root cause was when run with '-x', the verbose message like '+++/usr/sbin/rcntp ntptimeset .....' will be output to 'error output', that means get into $output. Then pmatch in the line 124 failed. To fix this problem, we can add wide char * at beginning of "Time could not*". Any thought?

122 output=eval $cmd 2>&1
123 rc=$?
124 if [ "$rc" != "0" ] || (pmatch "$output" "Time could not*");then
125 echo "$cmd failed, NTP maynot be synchronized, please wait for NTP synchronized then run updatenode nodename -P setu
pntp"
126 logger -t xcat "$cmd failed"
127 exit 1

Discussion