It is for veritas netbackup logs. The result we currently have is a single file for each day's backups. we will keep the files in the directory and the file names are like below mentioned.
example :/opt/openv/netbackup/reports/Daily/NB_success*. The No of files are above 2000 fiels are there.
The first column will contain the archive name and next column will have the date and time if the bacup success otherwise it will have 'x' or 'i','none'.
please write a script and the reuslt should be as given below. if you writen a shell script with name status.sh. the script should take flags like as given below.
SAP_DV4_Archive backups for the last month or year successful backups
example : status.sh -m=05 -y=06 -p=SAP_E4D_Archive
script name status.sh
-m month
-y year
-p backup policy name
You could include a "summary" option that will count up the number of input files as a baseline and report that SAP_E4D_Archive ran successfully on 26 of 31 days.
while getopts m:y:p: argmnt ####please use m colon y colon p colon
do
case $argmnt in
m) aflag=1
month="$OPTARG";;
y) bflag=1
year="$OPTARG";;
p) cflag=1
filter="$OPTARG";;
*) echo "Invalid argumetn passed.."
exit 99;;
esac
done
if [[ -z $aflag ]]
then
echo "month missing..Use: -m month -y year -p filter"
exit 1
fi
if [[ -z $bflag ]]
then
echo "year missing..Use: -m month -y year -p filter"
exit 2
fi
if [[ -z $cflag ]]
then
echo "Filter missing..Use: -m month -y year -p filter"
exit 3
fi
grep -h "$filter" NB_success* | grep "$month/$year"