#!/sbin/sh # #set -x # # Originally from # Brent L. Bates (UNIX Sys. Admin.) Phone:(757) 864-2854 # M.S. 912 Phone:(757) 865-1400, x204 # NASA Langley Research Center FAX:(757) 865-8177 # Hampton, Virginia 23681-0001 # Email: B.L.BATES@larc.nasa.gov http://www.vigyan.com/~blbates/ # Slick script heavily stuffed with and possible stuffed up (things deleted) by # Lachlan M. D. Cranswick 22nd April 1999 - l.cranswick@dl.ac.uk # http://www.ccp14.ac.uk - Daresbury Laboratory, Cheshire, UK. # Result is not so slick but seems to do the job as wanted - Lachlan. # TAPE=/dev/tape links to /dev/rmt/tps1d5 # TAPE=/dev/rmt/tps1d5 is telling the Seagate Scorpion 24 DLT/DDS3 to NOT do compression. # TAPE=/dev/rmt/tps1d5c is telling the Seagate Scorpion 24 DLT/DDS3 to do compression. # Last mod 23rd April 1999 - clean things up for cron. # Last mod 24th April 1999 - changing things so it will fit on one disk (forget saving / ) # 1st June 1999 Do a very simple script as this is for a very simple system. # - Also have good indication that tape drive is not compressing as it should. # Hopefully final Spiv up with logs and stuff 22nd June 1999 - Lachlan Cranswick DATE=`date '+Date_%y_%m_%d_Time_%H_%M__` LEVEL=0 TAPELABEL=CCP14_Archive_System_Level_${LEVEL}_uncompressed # TAPE=/dev/tape TAPE=/dev/rmt/tps1d5 # TAPE=/dev/rmt/tps1d5c TAPEDOMAIN=ccp14.ac.uk TAPEHOST=sv1.${TAPEDOMAIN} PARTITION=/ #PARTITION=/dev/dsk/dks1d3s7 LOG=logs/${DATE}${TAPELABEL}.log TAPE_ARGS=${TAPE} XFSDUMP="/etc/xfsdump -f ${TAPE_ARGS} -E -o -l ${LEVEL} -F -p 120 -L ${DATE}${TAPELABEL} -M ${DATE}${TAPELABEL} " # xfsdump options being used # -l level to use for dump 0=full # -o over-write the tape - take no prisoners - UNIX style. # -f which device to write to - in this case the tape # -p report to the screen or log file what is happening every x seconds - in this case every 180 seconds. # -F don't prompt the operator for anything - even if this means the universe will be destroyed or severely maimed. # -L session label # -M media label # (last option will be the file system to xfsdump but this is passed to the program below # via the $PARTITION variable) - $XFSDUMP $PARTITION # -R resume # -E pre-erase tape # -o over write tape # -f destination # -p 600 (tell user update status) # xfsrestore -i -f /dev/rmt/tps1d5 /tmp - interactive xfsrestore of individual files mt -f $TAPE rewind # UnCompressed: # Resume after it hits end of tape # xfsdump -R -f /dev/rmt/tps1d5 -E -o -l 0 -F -p 120 -L 29_may_1999__ccp14_web_disc_level0 \ # -M 30_may_1999_ccp14_web_disc_level0 /web_disc | tee 30_may_1999_ccp14_web_disc_level0.log.resume.uncompressed # mt -f /dev/rmt/tps1d5 offline if [ $? -ne 0 ]; then echo 'No tape loaded or something is wrong.' /usr/sbin/Mail -s "Tape not Loaded - Full Backup of CCP14 Failed `date`" ccp14@dl.ac.uk $LOG $XFSDUMP $PARTITION | tee $LOG mt -f $TAPE rewind mt -f $TAPE offline # mt -f $TAPE unload /usr/sbin/Mail -s "Full Backup of CCP14 System area Completed `date`" ccp14@dl.ac.uk < $LOG # End of Script `level_0_backup' run by cron