build-backup-restore

build_backup_restore
code format="bash"
 * 1) !/bin/bash


 * 1) Some variables

FQDN=`cat /etc/hosts | grep -v "#" | grep $(hostname) | awk '{print $2}'` TODAY=`date +%m/%d/%Y`


 * 1) First set up the files to be restored


 * 1) cp /etc/hosts /etc/hosts.test
 * 2) cp /var/log/messages /var/log/messages.test
 * 3) echo "change /etc/hosts.test to /etc/hosts.recover" > /var/tmp/rename_file
 * 4) echo "change /var/log/messages.test to /var/log/messages.recover" >> /var/tmp/rename_file
 * 5) cp /usr/openv/netbackup/bp.conf /usr/openv/netbackup/bp.conf.orig


 * 1) At this time, submit the CR to  using the GSMO UNIX BACKUP ADD profile to creat
 * 2) e the backup policies. Do not proceed with the rest of this section until the server has been se
 * 3) tup by GSMO and a full backup has completed.


 * 1) Menu

while true; do

echo -e "\n\nRestore Menu

1)   Prep the files for the restore

2)     Print the Add to Backup CR profile

3)     Run the bprestore test

4)     Clean up files after restore test successful

Selection: \c " read choice

case "$choice" in 1 ) # Prep the files for the restore       echo "Setting up files for the restore"        cp /etc/hosts /etc/hosts.test        cp /var/log/messages /var/log/messages.test        echo "change /etc/hosts.test to /etc/hosts.recover" > /var/tmp/rename_file        echo "change /var/log/messages.test to /var/log/messages.recover" >> /var/tmp/rename_file        cp /usr/openv/netbackup/bp.conf /usr/openv/netbackup/bp.conf.orig        ;;

2 ) # Print the Add to Backup CR profile               ~u8x1464/scripts/build_backup_cr        echo "Press any key to return to the menu or CTRL-C to exit"        read junk                ;;        3 ) # Run the bprestore test echo -e "Please choose the NetBackup Master GSMO used       1)         2)         3)         4)         5)         Selection: \c"                read SELECTION

case "$SELECTION" in       1) MASTER="";;        2) MASTER="";; 3) MASTER="";;       4) MASTER="";; 5) MASTER="";;        esac

echo "Restore job in progress..."

/usr/openv/netbackup/bin/bprestore -B -K -L /var/tmp/restore.details -R /var/tmp/rename_file -C $FQDN -S $MASTER -s $TODAY -e $TODAY -w 0 /etc/hosts.test /var/log/messages.test

echo "Restore finished. Press any key to return to the menu" read junk ;;       4 ) # Clean up files after restore test successful                echo "Cleaning up files..."        diff /var/log/messages.test /var/log/messages.recover        diff /etc/hosts.test /etc/hosts.recover        rm -f /etc/hosts.test /etc/hosts.recover        rm -f /var/log/messages.test /var/log/messages.recover        rm -f /var/tmp/restore.details /var/tmp/rename_file        exit                ;;

esac done code