Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
03-30-2009, 01:42 PM
|
#1
|
Member
Registered: Apr 2008
Location: Cleveland, Ohio
Distribution: SuSE, CentOS, Fedora, Ubuntu
Posts: 106
Rep:
|
Tomcat6 + CentOS 3/4/5"tomcat dead but subsys locked"
BUT - Tomcat is NOT dead - Tomcat is fine. The status function just can't find the pid. When I set the CATALINA_PID variable to "/var/run/tomcat.pid" in catalina.sh, it stores the pid, but the status script just checks if the pid in pid file is a string, then reports this error if it is ! How can I make the status script recognize when tomcat is actually running?
We're running tomcat6 on CentOS 3, 4, and 5.
Thanks!
Last edited by slinx; 03-30-2009 at 01:43 PM.
|
|
|
03-30-2009, 03:29 PM
|
#2
|
LQ Guru
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 27,659
|
Quote:
Originally Posted by slinx
BUT - Tomcat is NOT dead - Tomcat is fine. The status function just can't find the pid. When I set the CATALINA_PID variable to "/var/run/tomcat.pid" in catalina.sh, it stores the pid, but the status script just checks if the pid in pid file is a string, then reports this error if it is ! How can I make the status script recognize when tomcat is actually running?
We're running tomcat6 on CentOS 3, 4, and 5.
Thanks!
|
No, it doesn't check to see if the PID in the pid file is a string...it looks AT that string, and checks the process table to see if it's there.
How are you starting and stopping Tomcat? I'd suggest stopping it totally...kill ALL threads and other things associated with it, then delete that tomcat.pid file. Start Tomcat up using the startup script, which should write the new PID into that file...status function should then be able to find it, since the PID will be valid.
|
|
|
03-31-2009, 08:34 AM
|
#3
|
Member
Registered: Apr 2008
Location: Cleveland, Ohio
Distribution: SuSE, CentOS, Fedora, Ubuntu
Posts: 106
Original Poster
Rep:
|
I was using service start/stop tomcat
The catalina.sh was NOT writing the pid to the tomcat.pid file - I had to add the CATALINA_PID=/var/run/tomcat.pid variable to make it do that... but the behavior is the same EXCEPT on two CentOS 5 systems - the 3 and 4 systems still say tomcat is dead, yet the tomcat is still running and users can connect to it.
It does only look at the existence of the pid, it doesn't try to do anything with it - the test is merely [ -n $pid ]:
Code:
# First try "pidof"
pid=`pidof -o $$ -o $PPID -o %PPID -x $1 || \
pidof -o $$ -o $PPID -o %PPID -x ${base}`
if [ -n "$pid" ]; then
echo $"${base} (pid $pid) is running..."
return 0
fi
# Next try "/var/run/*.pid" files
if [ -f /var/run/${base}.pid ] ; then
read pid < /var/run/${base}.pid
if [ -n "$pid" ]; then
echo $"${base} dead but pid file exists"
return 1
fi
fi
# See if /var/lock/subsys/${base} exists
if [ -f /var/lock/subsys/${base} ]; then
echo $"${base} dead but subsys locked"
return 2
fi
|
|
|
03-31-2009, 08:37 AM
|
#4
|
Member
Registered: Apr 2008
Location: Cleveland, Ohio
Distribution: SuSE, CentOS, Fedora, Ubuntu
Posts: 106
Original Poster
Rep:
|
OK, it seems that the pidof program is failing to see the process, because it's looking for something named "tomcat" when it's actually named "java". I edited the /etc/init.d/functions script to get the pid correctly, and the /opt/tomcat6/bin/catalina.sh script to write the PID, and to check if tomcat is already running before starting another process.
Last edited by slinx; 03-31-2009 at 09:08 AM.
Reason: resolved
|
|
|
All times are GMT -5. The time now is 12:21 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|