Problem with awk hanging

I have a problem with an awk command.

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?

Kind Regards
/Andreas

You call it NO_OF_TP in other places. I don't see you incrementing or using NO_OF_NOT at any point after declaring it.

In the awk the variable n is used to increment.
NO_OF_NOT is only used as a constant.

Sorry I missed that.
But it still will not work.
It just hangs and will not stop.

-----------------------------------------
NO_OF_NOT=6

# Wait for $NO_OF_NOT notifications
echo "Will wait for $NO_OF_NOT start-notifications."
echo "Waiting..."

tail -F -n0 ~/consolelogs/start* \
| awk 'BEGIN { n = 0 } /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_NOT') exit}' >& 1 2> /dev/null

echo "All notifications received"
------------------------------------------

Are you getting any type=1s then? Make it echo something when it sees one so you see it's getting caught correctly.

Use a variable in awk:

tail -F -n0 ~/consolelogs/start* \
| awk -v NON=$NO_OF_NOT 'BEGIN { n = 0 }
/type=9/ {print "Servlet not Started Error: "; print} \
/type=5/ {print "Application could not be Started Error: "; print} \
/type=1/ {++n; print; if (n==NON)exit}' >& 1 2> /dev/null

Regards

Interpolating the shell variable into the script should work just as well.