#!/bin/bash

#srvchk.sh (c) Tim Onions 2007

# Please check this script works as expected on a test system before using on a production database.

# The author can accept no liability or responsibility for any ill-effect it may have.

# You are free to use this script on one condition - use it to improve the performance of your database!

srvctl config service -d $1 |awk '{print $1,$2,$3}' |sort >srvc.lst

srvctl status service -d $1 |awk '{print $2,$4,$7}' |sort >srvs.lst

pr -mt srvs.lst srvc.lst|awk 'BEGIN {print "#TOP"} ($1 != $4) {print "SEQUENCE ERROR"} ($3 != $6) {print "SERVICE ERROR:",$1," is ",$2," on ",$3," when ",$5," is ",$6} ($3 == $6) {print "SERVICE OK:",$1," is ",$2," on ",$3," and ",$5," is ",$6} END {print "#BTM"}'|grep "SERVICE ERROR:"