Originally Posted by druuna
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 ser
$ lsof -i:7001 | grep LISTEN
java 6045 firstgov 31u IPv4 0x30011c80de0 0t0 TCP s262789dc3su12.ushrnd2.savvis.net:7001 (LISTEN)