This recently stopped working. Any idea if I need to change anything in code?
TIME=`grep real < /tmp/EV_Check.time | cut -d ' ' -f2`
time=$TIME
test $time -ge $ct
result=$?
if [ "$result" -eq "1" ]
then
crit=1
msg="Report execution takes $time!"
fi
test $time -ge $wt
result=$?
if [ "$result" -eq "1" ]
then
warn=1
msg="Report execution takes $time!"
fi
if [ $crit -eq 1 -a $warn -eq 0 ]
then
echo "Critical value must be greater than warning value !"
help_usage
exit 3
fi
I am getting the below error:-
./check_ev_report.sh: line 158: test: 0.45: integer expression expected
./check_ev_report.sh: line 166: test: 0.45: integer expression expected
OK - 0.45
/tmp/EV_Check.time
contains the output oftime
. Bash arithmetic, including-ge
, works on integers only. Decimal points are not allowed, much less strings like9m50.017s
. – AlexP Nov 22 '16 at 20:52test
and[
are the same command! – Stéphane Chazelas Nov 22 '16 at 21:23OK
. Another is that you have errors on lines 158 and 166 of a 23-line script. – JdeBP Nov 22 '16 at 22:29