This is useful if you have a mirrored backup server that shouldnt process any data unless its currently live. If a failover occurs, the backup server will then realise it's live and process the information which the other server was currently processing.
Code Snippet
- #!/bin/sh
- ################################################################################
- # Does an NSLookup on a server DNS entry to determine which server is currently LIVE.
- ################################################################################
- #
- # Get LIVE server and query current server
- liveServer=`eval nslookup mgs | grep "Name:"`
- currentServer=`eval hostname`
- # Nslookup to see if this server is LIVE
- echo "$liveServer" | grep $currentServer >/dev/null 2>&1
- if [ "$?" -eq "0" ]; then
- echo "This IS the Live server"
- else
- echo "This IS NOT the Live server"
- fi
- exit 0
End of Code Snippet
No comments:
Post a Comment