I would like to write shell script to start and stop tomcat server.For stopping the tomcat I am using this command "./bin/shudown.sh" or "./bin/catalina.sh stop". This is not working most of the times, tomcat is still running.So I would like to kill the tomcat after giving shutdown command and wait for sometime(say 5min). Can anybody help me how to do it?
相关问题
- How to get the return code of a shell script in lu
- Is shmid returned by shmget() unique across proces
- how to get running process information in java?
- JQ: Select when attribute value exists in a bash a
- Tomcat and SSL Client certificate
You can use: pkill -9 tomcatServiceName or killall -9 tomcatServiceName.
./bin/catalina.sh
should support this. If you run that command without any options, it will print out its usage, which describes:In order to make this work, you need to set the environment variable
CATALINA_PID
to a file name that will be used to hold the Tomcat process ID. To start Tomcat, use:And then to stop it:
This will try to stop it, wait for 5 minutes, then kill it if necessary. Note that this will run in the foreground by default (locking up the terminal instance); use a trailing
&
to run the command in the background.