I have a expect script running on one node that is executing a command on another node.
Both nodes are Linux.
The script on the remote node is supposed to check a couple of logs after "type" notifications.
I am using tail and awk to do that.
The env NO_OF_NOT shall step each time a type=1 notification has been found and when 6 are found the script should exit:
-----------------------------------------
NO_OF_NOT=6
# Wait for $NO_OF_TP notifications
echo "Will wait for $NO_OF_TP start-notifications."
echo "Waiting..."
tail -F -n0 ~/consolelogs/start* \
| awk '/type=9/ {print "Servlet not Started Error: "; print} \
/type=5/ {print "Application could not be Started Error: "; print} \
/type=1/ {++n; print; if (n=='$NO_OF_TP') exit}' >& 1 2> /dev/null
echo "All notifications received"
------------------------------------------
The script works fine but it does not do exit when NO_OF_NOT has been reached.
What am I doing wrong?