With this script it's pretty simple to start/stop Tomcat on linux systems.
But if you decide to add jmxremote properties to your start script using $JAVA_OPTS variable, stopping of Tomcat (and mostly any other AppServer started with these options) will not succeed.
There will be an error message stating that the address is already in use (BindException) and you have to kill the process manually.
The solution is very simple. Make sure the stop command does not contain the jmxremote properties definition. So you might declare a $JAVA_OPTS for the start command as usual:
JAVA_OPTS="-Xmx256m -XX:MaxPermSize=128m -Dcom.sun.management.jmxremote.port=3336 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djava.rmi.server.hostname=192.168.1.5"
but for the stop command you must omit those jmx definitions and declare it for example like this:
The stop command then forks a JVM with the $JAVA_OPTS_STOP definition NOT trying to open another listening socket on an already bound port.