LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-11-2007, 03:00 PM   #16
ricmon
LQ Newbie
 
Registered: Jun 2007
Posts: 9

Original Poster
Rep: Reputation: 0

Quote:
Originally Posted by druuna
Hi,

No, it will go into lsof_checks.txt if it is actually found, if nothing is found an empty line is printed in no_lsof_checks.txt.

The program will only end up in the 'no listener' section if nothing is found (lsof -i:7001 | grep LISTEN has no output), if the output matches the string you will end up in the listener found section.

Take another look at post #11, I put some comments in them.
Maybe I'm missing something. The lsof command should produce output at least similar to the literal:

listening="java 6045 firstgov 31u IPv4 0x30011c80de0 0t0 TCP s262789dc3su12.ushrnd2.savvis.net:7001 (LISTEN)"

because the deamon is in fact listening on port 7001.

actual out put from server:

$ lsof -i:7001 | grep LISTEN
java 6045 firstgov 31u IPv4 0x30011c80de0 0t0 TCP s262789dc3su12.ushrnd2.savvis.net:7001 (LISTEN)
 
Old 06-11-2007, 03:27 PM   #17
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

It must be the listening string, it must be different then the actual output.

Try this from the command line to see if the string you are looking for exists:

ssh -T rmccown@10.35.25.50 "lsof -i:7001"

This should be done from where the script is run, not on 10.35.25.50.

If no output is found, try without the :7001 part and change 7001 accordingly.
If that generates output try:

ssh -T rmccown@10.35.25.50 "lsof -i:7001 | grep LISTEN"

If this doesn't generate output, change LISTEN to the appropriate token.
If that generates output copy-paste that output in your script (the 'listening=".........' line).

Hope this helps.
 
Old 06-12-2007, 10:04 AM   #18
ricmon
LQ Newbie
 
Registered: Jun 2007
Posts: 9

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by druuna
Hi,

It must be the listening string, it must be different then the actual output.

Try this from the command line to see if the string you are looking for exists:

ssh -T rmccown@10.35.25.50 "lsof -i:7001"

This should be done from where the script is run, not on 10.35.25.50.

If no output is found, try without the :7001 part and change 7001 accordingly.
If that generates output try:

ssh -T rmccown@10.35.25.50 "lsof -i:7001 | grep LISTEN"

If this doesn't generate output, change LISTEN to the appropriate token.
If that generates output copy-paste that output in your script (the 'listening=".........' line).

Hope this helps.
I am certain that the lsof check is producing the desired output as noted in post #16. The literal for the string comparison is in fact the output from the lsof command as it apperas in the script.
 
Old 06-12-2007, 10:31 AM   #19
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

Ok, last try.

Could you post your script and the output of ssh -T rmccown@10.35.25.50 "lsof -i:7001 | grep LISTEN".

And put code tags around them (code tags howto), this saves the layout (spaces and tabs, among other things).
 
  


Reply

Tags
string



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
CPU comparisons lothario Linux - Hardware 2 12-11-2006 08:25 PM
Discuss: Performance Comparisons confused_bof Linux - General 4 12-22-2005 03:40 PM
Perl string comparisons Xris718 Programming 5 04-03-2005 10:43 AM
Collecting TCO and other comparisons ggreaves General 1 02-02-2005 10:35 AM
Firewall Comparisons Please floppywhopper Linux - Security 11 10-02-2004 07:42 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:05 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