File tree Expand file tree Collapse file tree 1 file changed +16
-7
lines changed
scripts/vm/hypervisor/kvm Expand file tree Collapse file tree 1 file changed +16
-7
lines changed Original file line number Diff line number Diff line change @@ -158,40 +158,49 @@ write_hbLog() {
158158}
159159
160160check_hbLog () {
161+ hb_diff=0
161162 if [ ! -f " $hbFile " ]; then
162163 # signal large difference if file missing
163- return 999999
164+ hb_diff=999999
165+ return 1
164166 fi
165167 now=$( date +%s)
166168 hb=$( cat " $hbFile " 2> /dev/null)
167169 if [ -z " $hb " ]; then
168- return 999998
170+ hb_diff=999998
171+ return 1
169172 fi
170173 diff=` expr $now - $hb 2> /dev/null`
171174 if [ $? -ne 0 ]
172175 then
173- return 999997
176+ hb_diff=999997
177+ return 1
174178 fi
175179 if [ -z " $interval " ]; then
176180 # if no interval provided, consider 0 as success
177181 if [ $diff -gt 0 ]; then
178- return $diff
182+ hb_diff=$diff
183+ return 1
179184 else
185+ hb_diff=0
180186 return 0
181187 fi
182188 fi
183189 if [ $diff -gt $interval ]
184190 then
185- return $diff
191+ hb_diff=$diff
192+ return 1
186193 fi
194+ hb_diff=0
187195 return 0
188196}
189197
190198if [ " $rflag " == " 1" ]
191199then
192200 check_hbLog
193- diff=$?
194- if [ $diff == 0 ]
201+ status=$?
202+ diff=" ${hb_diff:- 0} "
203+ if [ $status -eq 0 ]
195204 then
196205 echo " =====> ALIVE <====="
197206 else
You can’t perform that action at this time.
0 commit comments