#!/bin/sh
#########################################################################
#
# Script Name : Snap_Script
#
# Description : This scripts takes clsuter snapshot backup
#########################################################################

SERVER=$(uname -n)
CLUS=
DIR=/usr/es/sbin/cluster/snapshots
mv $DIR/${CLUS}_cluster_snap.odm $DIR/${CLUS}_cluster_snap.odm.old
mv $DIR/${CLUS}_cluster_snap.info $DIR/${CLUS}_cluster_snap.info.old
LOG=/usr/local/scripts/snap-script-log
NF=/tmp/snap-script-nf
/usr/es/sbin/cluster/utilities/clsnapshot -c -i -n ${CLUS}_cluster_snap -d ${SERVER}_CLUSTER 2>/dev/null >$LOG
if [ $? -eq 0 ]
then
find $DIR -name "*.info" -amin -10 >$NF
find $DIR -name "*.odm" -amin -10 >>$NF
CK=`cat $NF |wc -l`
if [ "$CK" -ne 2 ]
then
echo "Snapshot has Failed for $SERVER" >>$LOG
errlogger " Cluster Snapshot Failed, Please investigate"
else
echo "Snap is completed sucessfully for $SERVER" >>$LOG
fi
else
echo "Snapshot has Failed For $SERVER" >>$LOG
errlogger " Cluster Snapshot Failed, Please investigate"
fi
Advertisements