This script is supposed to find out if tomcat is running or not.
Code:
#!/bin/sh
if netstat -a | grep `grep ${1}: /tomcat/bases | awk -F: '{print $3}'` > /dev/null
then
echo Tomcat for $1 running
else
echo Tomcat for $1 NOT running
fi
the /tomcat/bases is a file that contains a list of all the tomcat instances running and which port number it is running
Code:
user1:yes:8080
user2:no:8081
user3:yes:8082
I know it uses netstat to check if any of the port numbers in the "bases" file is listening but i dont quite understand how this is achieved by that command shown above.
Thanks