I am trying to write a shell scrip to monitor status of my Application services.
Please find my shell script below.
I am trying to increment variable ‘requesters_IN’ by 1
Any idea why expr is throwing the error saying “non-integer argument”
#!/bin/bash
requesters_INB=$(less /App/tomcat/inb/common/settings.cfg | grep REQUESTER_IN | awk '{print $3}')
status=0
requesters_IN=`expr "$requesters_IN" + 1)`
echo $requesters_IN
cd /App/tomcat/inb/Requester/ || exit
upInstances=$(./Ping.sh 1 | grep 'up and running' | grep -v grep | wc -l)
if [ "$upInstances" != $'requesters_IN' ]
then
status=1
fi
But I am getting below output
expr: non-integer argument
requesters_IN
I tried the below steps to add 1.
#requesters_IN=$(($requesters_IN + 1))
#requesters_IN=$(expr “$requesters_IN” + 1)
New contributor