Here is a basic interactive restore script as requested.
At the moment, this does NOT cope with alternate location restores - I'll add this when I get time.
It does not really do any checking - for example, is the master server name entered valid etc ... This is not really essential for basic functionality, I might add this in if I get time.
Run it like this .. /tmp/filelist contains the list of files to restore in format :
/path/to/file1
/path/to/file2
Run it like this ...
./restore2.sh 04/16/2012
Tmp restore directory /tmp/sym/restore already exists
Please enter value for MASTER
womble
Please enter value for SOURCE
womble
Please enter value for DESTINATION
womble
Please enter value for FILELIST
/tmp/filelist
Here is the script ...
#!/usr/bin/ksh
#Define a few variables ...
DIR=/tmp/sym/restore #DIR used for 'tmp' files
LOG=$DIR/restore_log.txt
FILELIST=$DIR/FILELIST
MASTER=$DIR/MASTER
SOURCE=$DIR/SOURCE
DESTINATION=$DIR/DESTINATION
STARTDATE=$1
#Create directory
create_dir () {
if [[ -d $DIR ]]
then
echo "Tmp restore directory $DIR already exists"
else
mkdir $DIR
echo "Created directory $DIR"
fi
}
collect_values () {
for i in MASTER SOURCE DESTINATION FILELIST
do
echo "Please enter value for $i"
read VALUE
echo $VALUE >$DIR/$i
done
}
run_restore () {
bprestore -s $STARTDATE -S $(cat $MASTER) -C $(cat $SOURCE) -D $(cat $DESTINATION) -L $LOG -f $(cat $FILELIST)
}
#Main script
create_dir
collect_values
run_restore