Skip to content

Instantly share code, notes, and snippets.

@anallely
Created September 30, 2014 13:33
Show Gist options
  • Save anallely/bd498ddfefe3b535a8dc to your computer and use it in GitHub Desktop.
Save anallely/bd498ddfefe3b535a8dc to your computer and use it in GitHub Desktop.
Monitoring tomcat start (catalina.out)
BASEDIR=$(dirname $0)
PARENTDIR=$(dirname $(dirname $0))
$BASEDIR/startup.sh
FILE=$PARENTDIR/logs/catalina.out
tail -f $FILE |
while read line
do
echo "$line"
if [[ $line == *"Catalina.start Server startup"* ||
$line == *"Tomcat may not be running"* ]]
then
echo "Log was analyzed" && pkill -P $$ tail
break
fi
done
if grep -q "Catalina.start Server startup" $FILE
then
echo "Exiting with 0: SUCCESSFUL"
exit 0
else
echo "Exiting with 1: ERROR"
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment