LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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


Reply
  Search this Thread
Old 03-30-2009, 01:42 PM   #1
slinx
Member
 
Registered: Apr 2008
Location: Cleveland, Ohio
Distribution: SuSE, CentOS, Fedora, Ubuntu
Posts: 106

Rep: Reputation: 23
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.
 
Old 03-30-2009, 03:29 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,636

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by slinx View Post
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.
 
Old 03-31-2009, 08:34 AM   #3
slinx
Member
 
Registered: Apr 2008
Location: Cleveland, Ohio
Distribution: SuSE, CentOS, Fedora, Ubuntu
Posts: 106

Original Poster
Rep: Reputation: 23
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
 
Old 03-31-2009, 08:37 AM   #4
slinx
Member
 
Registered: Apr 2008
Location: Cleveland, Ohio
Distribution: SuSE, CentOS, Fedora, Ubuntu
Posts: 106

Original Poster
Rep: Reputation: 23
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
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
radiusd dead but subsys locked i_nomad Linux - Server 3 10-20-2008 02:08 AM
psa dead but subsys locked sachin1361 Linux - Enterprise 2 08-07-2007 06:34 AM
ser dead but subsys locked jorain Linux - Newbie 1 08-04-2006 11:33 PM
"vsFTPD is dead but syskey locked" in RH9 services. SPo2 Linux - Networking 3 06-26-2006 11:16 PM
Error: "mysqld dead but subsys locked" mikeshn Linux - Software 1 01-01-2004 05:18 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:27 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration