#!/bin/csh -f # # nightly_backup.sh - written by Kevin P. Inscoe (kevin.inscoe@cbis.com) # # define global environment variables source /opt/bin/ondemand_globals.sh env # define local variables set adsm_save = "/home/archive/adsm/adsmfiles_`/bin/date '+%y%m%d'`.tar" # announce ourselves /bin/echo "Nightly OnDemand backup beginning at" `/bin/date` "..." /bin/uname -a # First cleanup old archives to make room for new archives... /opt/bin/clean_archive.sh # This will stop Kronstadt monitors touch /tmp/arssockd.monitor.must.die # This will stop OnDemand server /opt/bin/dgsp arssockd # shutdown DB2 from OnDemand # shutdown DB2 /bin/echo "Stopping DB/2..." /bin/cat << EOF | db2 connect to archive force application all quit EOF /bin/echo "Stopping DB/2 from OnDemand..." /usr/lpp/ars/bin/arsdb -hv sleep 30 # restart DB2 without OnDemand /bin/ps -ef | /bin/grep db2 /bin/echo "Restarting DB/2 without OnDemand..." db2start sleep 30 # start OnDemand backup /usr/lpp/ars/bin/arsdb -v -y /home/archive # Start DB/2 archive connection /usr/lpp/ars/bin/arsdb -gkv # backup ADSM catalogs database to /adsmfiles /usr/lpp/ars/bin/ars_adsm -dv # tar /adsmfiles to /home/archive/adsm and compress cd /adsmfiles /bin/echo "adsm save file is" $adsm_save /bin/tar cvf $adsm_save . /bin/compress $adsm_save # Restart OnDemand listeners now sleep 300 /usr/lpp/ars/bin/arssockd # Restart Kronstadt monitors now /usr/bin/nohup /opt/bin/ondemand_arssockd_monitor.sh & # Make sure the tape is at BOT #/bin/mt rew /bin/mt status # Perform the savevg of homevg /usr/bin/savevg -m -f /dev/rmt0 homevg # Eject the tape out of the drive /bin/mt offline # Now purge-off last nights archives /opt/bin/clean_archive.sh # Say goodnight Gracie... /bin/echo "Nightly OnDemand backup done at" `/bin/date` "..." /bin/uname -a exit 0