#!/bin/sh
#
BINDIR=/usr/local/monitoring/princeton
# Run ksping on a pair of keyservers
kprimary=$1
kshadow=$2
# Check the primary server
$BINDIR/ksping_linux -q $kprimary.princeton.edu
RC1=$?
# Check the shadow server
$BINDIR/ksping_linux -q -t 1 $kshadow.princeton.edu
RC2=$?
if [ '(' $RC1 -eq 3 ')' -o  '(' $RC1 -eq 6 ')' -o  '(' $RC1 -eq 7 ')' ]
then
    if [ '(' $RC2 -eq 3 ')' -o  '(' $RC2 -eq 6 ')' -o  '(' $RC2 -eq 7 ')' ]
	then
  		echo "$kprimary and $kshadow Keyservers are BOTH down"	
  		exit 2
    fi
else
  	echo "Keyservice is up" 
  	exit 0
fi
