#! /bin/sh
# Author: Sheng Huiping
# Date: Feb 1 2012
#
Date=`date +%Y_%m_%d`
log=/tmp/tsm/tsm_backup_$Date.log
# List the TSM backup event for one day:
/usr/tivoli/tsm/client/ba/bin/dsmadmc -id=support -pass=abcd1234 "q event * * begindate=-1 begintime=12:00:00 enddate=-0 endtime=11:59:59" > /tmp/tsm.out
# Cut and create the TSM backup event status file:
awk 'n==1{print} $0~/---/{n=1}' tsm.out > file.out
sed -e '/ANS8002I/d' file.out > /tmp/file01.out
sed -e '/^$/d' /tmp/file01.out > /tmp/file02.out
awk 'NF != 1{print}' file02.out > file03.out
awk 'NF != 2{print}' file03.out > file04.out
# Check the TSM backup status one by one:
cat /tmp/file04.out | while read line
do
LINE=$line
echo "$LINE" >file04
awk '{print $7}' file04 > status_file
awk '{print $6}' file04 > node_name
STATUS=`cat status_file`
NODE=`cat node_name`
if [ "$STATUS" != "Completed" ]
then
return_code=1
else
return_code=0
fi
if [ "$return_code" -eq 1 ]
then
echo "$NODE backup abnormal !" >> $log
else
echo "$NODE normal" >> $log
fi
done