Restarting Tomcat

Although Tomcat does it's job very well in most circumstances, it sometimes "gets stuck". This may happen when for example you're making changes to your webapps, starting and stopping a lot and in general use a lot of CPU.
You should always try first to stop the Tomcat-service using the daemon. Login to your server and issue the commands:

cd /etc/init.d
sudo ./tomcat stop

To check if this was succesfull, list the processes:

ps -ef

You should see no processes owned by user tomcat. But sometimes processes remain active, for example if a database action needs to be finished. (And then you see processes owned by user progres, with postgres-user clinica on database openclinica.)
Your reaction may be to stop tomcat again, but if you issue the command, you get "Tomcat already stopped". In that case you have to kill the process. And not only the tomcat-process, but also all linked processes. To do this you must use the proces-id and you can find this with

ps -ef

or, if you have many processes, with

ps -f -U tomcat

Look at the second column, PID, and use that number to kill the process:

kill -9 6203

where 6203 is the PID of tomcat's proces and the switch "-9" indicates that child-processes should be stopped as well. Type "ps -ef" to make sure no tomcat-proces is running, and then start the daemon again with:

sudo ./tomcat start