Fixed endless while loop

Added a counter in so we do not get stuck in endless while loop which could hang a server at bootup... also set it to kill tomcat if it does not stop within 30 seconds and then tries to do a kill -9 after an addition 5 seconds... then gives up...