0% found this document useful (0 votes)
77 views

Check Networker Server

This script checks the status of a backup server and notifies appropriate contacts if it is unreachable or not responding. It first checks the current time and limits manual runs to every 25 or 55 minutes. It then attempts to contact the server, waits 60 seconds and retries if no response before triggering an alert email with details.

Uploaded by

puneetgoyal100
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
77 views

Check Networker Server

This script checks the status of a backup server and notifies appropriate contacts if it is unreachable or not responding. It first checks the current time and limits manual runs to every 25 or 55 minutes. It then attempts to contact the server, waits 60 seconds and retries if no response before triggering an alert email with details.

Uploaded by

puneetgoyal100
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

#!

/bin/ksh
# set -x
. /nsr/scripts/.profile

CURRENT_TIME_EPOCH=`date +%s`
CURRENTHOUR=`date +"%H"`
CURRENTMINUTE=`date +"%M"`
if [ $1 ] && [ $1 = NO_MANUAL_RUN ] && [ $CURRENTMINUTE = 25 ] || [ $CURRENTMINUTE
= 55 ]
then
echo "Proceeding..." >/dev/null
else
echo "Exiting...Running this script manually is prohibited"
exit
fi

ls /nsr/scripts/.lock_check* >> /dev/null 2>&1


if [ $? = 0 ]
then
echo "nsradmin error : Cannot Contact Backup Server MV3WBKSV01PRV. Appears
that backup server is Hung or Down. Please check status manually and investigate if
there is an issue." | /bin/mailx -s "mv3wbksv01prv.smrc.sidra.org's ATWE
notification,Hostname: mv3wbksv01prv, Profile: Custom, Severity: 2"
[email protected],[email protected],[email protected],[email protected],pra
[email protected],[email protected],[email protected],Sandeep_Bat
[email protected],[email protected],[email protected] -- -f
[email protected]
exit
else
touch /nsr/scripts/.lock_check
chmod 600 /nsr/scripts/.lock_check
fi
trap "rm /nsr/scripts/.lock_check;echo interrupted...;exit" 2

echo help | nsradmin -s mv3wbksv01prv-prod.smrc.sidra.org -i - >/dev/null 2>&1


if [ $? -eq 0 ]
then
logger "nsradmin notice : Backup Server MV3WBKSV01PRV is alive"
else
sleep 60
echo help | nsradmin -s mv3wbksv01prv.smrc.sidra.org -i - >/dev/null 2>&1
if [ $? -eq 0 ]
then
logger "nsradmin notice : Backup Server MV3WBKSV01PRV is alive"
else
logger "nsradmin notice : Backup Server MV3WBKSV01PRV is not responding"
echo "nsradmin error : Cannot Contact Backup Server MV3WBKSV01PRV. Appears
that backup server is Hung or Down. Please check status manually and investigate if
there is an issue." | /bin/mailx -s "mv3wbksv01prv.smrc.sidra.org's ATWE
notification,Hostname: mv3wbksv01prv, Profile: Custom, Severity: 2"
[email protected],[email protected],[email protected],[email protected],pra
[email protected],[email protected],[email protected],Sandeep_Bat
[email protected],[email protected],[email protected] -- -f
[email protected]
fi
fi

rm /nsr/scripts/.lock_check

You might also like