LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 04-11-2011, 02:21 PM   #1
nade
LQ Newbie
 
Registered: May 2009
Posts: 2

Rep: Reputation: 0
Tomcat5 Hangs Redhat 5.5


I'm running SpaceWalker which executes this perl script

PHP Code:
echo "Waiting for tomcat to be ready ..."

while [ -"/var/run/$TOMCAT.pid" ] ; do
    /
usr/sbin/lsof --i TCP:8009 -$(cat /var/run/$TOMCAT.pid) > /dev/null && break
        
sleep 1
done 
This just hangs.. and hangs..

I tried changing the lsof command to

PHP Code:
/usr/sbin/lsof --@localhost:8009 -$(cat /var/run/$TOMCAT.pid) > /dev/null && break 

No difference. This is a VM host that I built of a template that someone made a long time ago. Is there any configuration I might have missed ie: iptables settings ?

My etc/hosts file:

PHP Code:
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1               localhost.localdomain localhost
142.229.134.184 template_rh5_64
-bit     template_rh5_64-bit.secretplacelol 
 
Old 04-13-2011, 07:57 AM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
It appears you're trying to restrict the output to be for the PID of tomcat. To do that you need to use the "-a" ("and") flag:


Code:
/usr/sbin/lsof -t -i TCP:8009 -a -p $(cat /var/run/$TOMCAT.pid)
Also you don't really need to provide "TCP" or "localhost" if all you're interested in is the port - you can just put ":8009":

Code:
/usr/sbin/lsof -t -i :8009 -a -p $(cat /var/run/$TOMCAT.pid)
Finally you're doing a while loop - this means as long as the condition is true it will repeat the loop. It may be what you're thinking is a "hang" is in fact just an infinite loop. Since I don't know the purpose of your script I can't tell if you intended such a loop.

Also the output of the command would simply be the pid of the process. I'm assuming your intent is to verify that the port is open and associated with the Tomcat process. If you only want to know the PID it is already predetermined in your /var/run/$TOMCAT.pid file.
 
  


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
System Hangs up at Redhat 7.3 kapazang Linux - Hardware 3 03-05-2007 03:04 AM
RedHat AS hangs UnderCoverBroth Red Hat 3 10-01-2004 09:42 PM
Redhat Hangs on Startup RADIAN03 Linux - Software 2 06-07-2003 06:13 PM
redhat 8.0 hangs at bluecurve sidestrand Linux - Distributions 2 05-21-2003 08:30 AM
RedHat 7.3 Install Hangs penitent23 Linux - Newbie 7 04-06-2003 01:14 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 03:39 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
Open Source Consulting | Domain Registration