Guys I am new to this forum, this may seem like a cheeky request.
I have been asked by my manager to convert this ksh script to Perl. I do not have the foggiest about Perl and would appreciate any help on this.
Basically this scipt automates a recovery process for EMC Legato Networker. It will find all the relevant full and incremental backups for the period of recovery. As at present we have to type in
recover -s (server name) -S ssid
for all savesets which is tedious.
For any one that does this I will buy them a few beers
#!/bin/ksh
#
#
#
#set -x
NSR_LOG=`pwd`/nsrssrecover.log
#script -a $NSR_LOG <<EOT
NSR_JUKEBOX="IBM@3.4.1"
NSR_SERVER=sghmgtnwksrv001
NSR_CLIENT=`hostname`
NSR_RECDATE="08/28/08 23:30:00"
NSR_DEST=/tmp/drazen
NSR_FILESYSTEM=/
NSR_LOG=`pwd`/nsrssrecover.log
export NSR_SERVER NSR_CLIENT NSR_RECDATE NSR_DEST NSR_FILESYSTEM NSR_LOG NSR_JUKEBOX
LC_TIME=c
NSR_STARTDATE=`mminfo -s $NSR_SERVER -o t -q "name=$NSR_FILESYSTEM,level=full,savetime<$NSR_RECDATE,client=$NSR_CLIENT" -r "savetime(18)" | tail -1`
print "Volume Date Time Level Name"
printf "%s\n" "--------------------------------------------------------------------------------"
NSR_SAVELIST=`mminfo -s $NSR_SERVER -o t -q "savetime>=$NSR_STARTDATE,savetime<=$NSR_RECDATE,client=$NSR_CLIENT,name=$NSR_FILESYSTEM" -r ssid`
for NSR_SSID in $NSR_SAVELIST
do
NSR_CLONEID=`mminfo -s $NSR_SERVER -q "ssid=$NSR_SSID,location=$NSR_JUKEBOX" -r cloneid | tail -1 | sed -e "s/^ *//"`
if [ -z "$NSR_CLONEID" ]
then
print "E000001 Unable to locate saveset localy in library"
mminfo -s $NSR_SERVER -q "ssid=$NSR_SSID" -r "volume,location,ssid,cloneid,client,name"
else
mminfo -s $NSR_SERVER -q ssid=$NSR_SSID,cloneid=$NSR_CLONEID -r "volume(12),savetime(18),level(6),name" | tail -1
fi
done
printf "%s\n" "--------------------------------------------------------------------------------"
for NSR_SSID in $NSR_SAVELIST
do
NSR_CLONEID=`mminfo -s $NSR_SERVER -q "ssid=$NSR_SSID,location=$NSR_JUKEBOX" -r cloneid | tail -1 | sed -e "s/^ *//"`
if [ -z "$NSR_CLONEID" ]
then
exit 2
fi
print "recover -iY -s $NSR_SERVER -S $NSR_SSID/$NSR_CLONEID -d $NSR_DEST"
done
exit 0
#EOT