#!/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. # Level 1 script modified from level_0 script 9th June 1999 # Hopefully final Spiv up with logs and stuff 22nd June 1999 - Lachlan Cranswick # In the level one backups - put touch commands on the important files so that these files # always retrievable from any level one backup. 24th June 1999 # (though could be highly stupid thing to do?) Lachlan DATE=`date '+Date_%y_%m_%d_Time_%H_%M__` LEVEL=1 TAPELABEL=CCP14_Archive_Webdisc_Level_${LEVEL}_ # TAPE=/dev/tape # TAPE=/dev/rmt/tps2d5 TAPE=/dev/rmt/tps2d5c TAPEDOMAIN=ccp14.ac.uk TAPEHOST=sv1.${TAPEDOMAIN} PARTITION=/web_disc #PARTITION=/dev/dsk/dks1d3s7 LOG=logs/${DATE}${TAPELABEL}.compressed.log TAPE_ARGS=${TAPE} #--- Copy / system files over so it gets in on this backup as well cp /etc/inetd.conf /web_disc/local/backup/system cp /etc/hosts.allow /web_disc/local/backup/system cp /etc/hosts.deny /web_disc/local/backup/system cp /etc/passwd /web_disc/local/backup/system cp /etc/group /web_disc/local/backup/system cp /etc/hosts /web_disc/local/backup/system cp /etc/rsyncd.conf /web_disc/local/backup/system cp /etc/services /web_disc/local/backup/system cp /etc/protocols /web_disc/local/backup/system cp /etc/sshd_config /web_disc/local/backup/system cp /etc/config/portmap.options /web_disc/local/backup/system cp /var/adm/SYSLOG /web_disc/local/backup/system cp /var/adm/oSYSLOG /web_disc/local/backup/system cp /etc/ftpusers /web_disc/local/backup/system #touch important files so they are always retrievable from a level 1 backup # use -c option so that files are no accidentally created by touch. touch -c /web_disc/ccp14/web_area/mirrorbin/wget.script.* touch -c /usr/local/backup/level_* touch -c /web_disc/ccp14/.crontab touch -c /web_disc/ccp14/web_area/mirrorbin/logs/report-proforma.txt touch -c /usr/local/apache/conf/x.* touch -c /usr/local/apache/conf/httpd.conf touch -c /usr/local/apache/conf/mime.types touch -c /usr/local/apache/share/cgi-bin/icsd/icsd/icsd.setup touch -c /web_disc/ccp14/web_area/icsd/bin/*.key # XFSDUMP="/etc/xfsdump -f ${TAPE_ARGS} -E -o -l ${LEVEL} -F -p 120 -L ${DATE}${TAPELABEL} -M ${DATE}${TAPELABEL} " XFSDUMP="/etc/xfsdump -f ${TAPE_ARGS} -E -o -l ${LEVEL} -F -p 120 -L ${DATE}${TAPELABEL} -M ${DATE}${TAPELABEL} " echo ${TAPE_ARGS} > arguments.txt echo ${DATE}${TAPELABEL} >> arguments.txt echo ${XFSDUMP} >> arguments.txt # 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 # xfsrestore -i -f /dev/rmt/tps1d5c /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/tps2d5 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 # End of Script `level_1_backup' run by cron /usr/sbin/Mail -s "Incremantal Level 1 Backup of CCP14 Finished `date`" ccp14@dl.ac.uk < $LOG