#!/bin/bash { statuscode=$(wget --server-response http://localhost:8080 2>&1 | awk '/^ HTTP/{print $2}') if [ $statuscode -eq 200 ] then echo "TOMCAT OK"; retval=0; fi if [ $statuscode -eq 404 ] then echo "TOMCAT CRITICAL"; retval=2; fi exit $retval; }