0

I have a server running many JAVA application's with tomcat 6.0.18, i need to know how can i scheduele a shutdown of just 'X' application and keep other's running.

I'll appreciate your ideas

thanks

ME-KJ
  • 1
  • 1
  • 1

3 Answers3

2

Take a look at this: http://tomcat.apache.org/tomcat-6.0-doc/manager-howto.html#Supported%20Manager%20Commands

or move your mouse to the "Stop" link on the Tomcat Manager Web UI, and look at the status bar you will see the URL to stop that app. You can call it with a script via wget, curl, lynx, ...

quanta
  • 50,327
  • 19
  • 152
  • 213
0

Access Tomcat Manager via URL http://ip:8080/manager, you will see a list of running applications. And from this, you can stop any webapp which you want.

quanta
  • 50,327
  • 19
  • 152
  • 213
  • @quanta : thanks for your reply, i know that i can shutdown an apps from tomcat manager console but my request is how can i schedule it thank you again – ME-KJ May 30 '11 at 10:15
  • If you are running Tomcat on Linux, you can kill it by getting the PID from the port which your app is running: `netstat -nlp | grep java | grep :port | awk '{ print $7 }' | awk -F "/" '{ print $1 }'` – quanta May 30 '11 at 10:53
  • RE, my tomcat is using 4519 ports for all apps and i want just shutdown X apps not all tomcat apps thanks – ME-KJ May 30 '11 at 11:02
  • Did you try to kill it based on the app name? – quanta May 30 '11 at 13:00
  • no how can i do that? tks – ME-KJ May 30 '11 at 14:41
  • Give us the output of `ps -ef | grep java` and which app did you want to kill? – quanta May 30 '11 at 15:14
  • this is the output of ps -ef | grep java ----- root 20342 1 7 May27 ? 06:52:20 /usr/bin/java -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.util.logging.config.file=/home/myserver/tomcat-6.0.18/conf/logging.properties -Xmx4096M -XX:MaxPermSize=4096M -Djava.endorsed.dirs=/home/myserver/tomcat-6.0.18/endorsed -classpath :/home/myserver/tomcat-6.0.18/bin/bootstrap.jar -Dcatalina.base=/home/myserver/tomcat-6.0.18 -Dcatalina.home=/home/myserver/tomcat-6.0.18 -Djava.io.tmpdir=/home/myserver/tomcat-6.0.18/temp org.apache.catalina.startup.Bootstrap start – ME-KJ May 31 '11 at 10:41
  • i tryed to stop apps by wget command but i got this message ----- --2011-05-31 11:45:14-- http://localhost:8080/manager/html/stop?path=/ab Resolving localhost... ::1, 127.0.0.1 Connecting to localhost|::1|:8080... connected. HTTP request sent, awaiting response... 401 Non-Autorisation Authorization failed. – ME-KJ May 31 '11 at 10:47
  • Did you define a user with "manager" role? Did you try to login to Tomcat Manager via web browser? Have a look at `conf/tomcat-users.xml`. Read `man wget` to specific the corresponding account with `--user` and `--password` options. – quanta Jun 01 '11 at 02:15
  • yes i have a user defined as manager role and i logged into tomcat manager page via chrome, still finding a solution ... – ME-KJ Jun 08 '11 at 15:15
0

I use wget to stop et start applications the user in tomcat-user.xml must have manager-script roles For TOMCAT 5,6:

wget "http://<user>:<password>@<servername>:<port>/manager/stop?=/<application context>" -O - -q
wget "http://<user>:<password>@<servername>:<port>/manager/start?=/<application context>" -O - -q

Since TOMCAT 7 (7.0.62 for my installation) you have to add /text/ after manager:

wget "http://<user>:<password>@<servername>:<port>/manager/text/stop?=/<application context>" -O - -q
wget "http://<user>:<password>@<servername>:<port>/manager/text/start?=/<application context>" -O - -q

Hope it's helpful