LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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, 02: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 02:43 PM.
 
Old 03-30-2009, 04:29 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 22,301

Rep: Reputation: 6003Reputation: 6003Reputation: 6003Reputation: 6003Reputation: 6003Reputation: 6003Reputation: 6003Reputation: 6003Reputation: 6003Reputation: 6003Reputation: 6003
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, 09: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, 09: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 10:08 AM. Reason: resolved
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 03:08 AM
psa dead but subsys locked sachin1361 Linux - Enterprise 2 08-07-2007 07:34 AM
ser dead but subsys locked jorain Linux - Newbie 1 08-05-2006 12:33 AM
"vsFTPD is dead but syskey locked" in RH9 services. SPo2 Linux - Networking 3 06-27-2006 12:16 AM
Error: "mysqld dead but subsys locked" mikeshn Linux - Software 1 01-01-2004 06:18 PM

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

All times are GMT -5. The time now is 09:46 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration