You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Princeton/pu/libexec/check_keyserver_mme_service.sh

47 lines
956 B
Bash

#!/bin/sh
#
BINDIR=/usr/local/monitoring/princeton
# Run ksping on a pair of keyservers
kprimary=$1
kshadow1=$2
kshadow2=$3
incnt=0
# Check the primary server
$BINDIR/ksping_linux -q $kprimary.princeton.edu
RC1=$?
# echo $RC1
if [ '(' $RC1 -eq 3 ')' -o '(' $RC1 -eq 6 ')' -o '(' $RC1 -eq 7 ')' ]
## if [ 2 -eq 3 ]
then
incnt=`expr $incnt + 1`
# echo $incnt
fi
# Check the shadow1 server
$BINDIR/ksping_linux -q -t 1 $kshadow1.princeton.edu
RC2=$?
# echo $RC2
if [ '(' $RC2 -eq 3 ')' -o '(' $RC2 -eq 6 ')' -o '(' $RC2 -eq 7 ')' ]
## if [ 4 -eq 4 ]
then
incnt=`expr $incnt + 1`
# echo $incnt
fi
# Check the shadow2 server
$BINDIR/ksping_linux -q -t 1 $kshadow2.princeton.edu
RC3=$?
# echo $RC3
if [ '(' $RC3 -eq 3 ')' -o '(' $RC3 -eq 6 ')' -o '(' $RC3 -eq 7 ')' ]
# if [ 3 -eq 6 ]
then
incnt=`expr $incnt + 1`
# echo $incnt
fi
if [ $incnt -eq 3 ]
then
echo "Keyservice is down"
exit 2
else
echo "Keyservice is up"
exit 0
fi