Return to BSD News archive
Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!news.rmit.EDU.AU!aggedor.rmit.edu.au!phillip From: phillip@mirriwinni.cse.rmit.edu.au (Phillip Musumeci) Newsgroups: comp.unix.bsd.freebsd.misc Subject: Re: Backup Suggestions? Date: 29 Dec 1995 04:50:47 GMT Organization: Computer Systems Engineering Department, RMIT Australia Lines: 246 Message-ID: <PHILLIP.95Dec29155047@mirriwinni.cse.rmit.edu.au> References: <4bvhar$og3@gol2.gol.com> Reply-To: phillip@mirriwinni.cse.rmit.edu.au NNTP-Posting-Host: pm.cse.rmit.edu.au Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII In-reply-to: Doug Lerner's message of 29 Dec 1995 01:47:07 GMT >>>>> "Doug" == Doug Lerner <doug@gol.com> writes: Doug> This time it is about backup. Doug> Somebody wrote in a recent message that 99% of the important Doug> local configuration files were in /etc, so I think I will at Doug> least try to backup /etc to floppies today. Hi, Enclosed is a script that I use to take a snapshot of my system's settings --- the idea is that if you have to rebuild the system (and do it with the same file system setup), then you can use the contents of the snapshot to reconfigure the system back to the way you had it. phillip #!/bin/sh # # Purpose: create a snapshot of the essential configuration information # of a host. This is useful when upgrading the OS. # # Use: to create the archive in current area [or destination-dir], enter # clone-system [destination-dir] # # phillip@cse.rmit.edu.au # # 16-12-1995: added switch -f to allow capture of kernel config & /var/mail, # and force all files to be stored with full file specs in # order to simplify extraction later (when you would just # extract and overwrite). # ########################################################################### CLONESYSV="[2.1.0 16 December 1995]" echo "Script clone-system $CLONESYSV" INTERACTIVE=1 # Clear variables holding system-wide softlinks. OURLINKS= MISCF= TABFILES= ROOTFILES= XHOME=/usr/X11R6 #-------------------------------------------------------------------------# # Handle root's files here (before script parameters are handled) # save any root bash shell (even an old bash is better than no bash) test -f /root/bin/bash && ROOTFILES="$ROOTFILES /root/bin/bash" # save uemacs if present (emacs users _need_ this to set up a new system) test -f /root/bin/uemacs && ROOTFILES="$ROOTFILES /root/bin/uemacs" # root dot files for x in /root/.bash_log* /root/.inputrc /root/.bashrc* /root/.rhosts ; do test -f $x && ROOTFILES="$ROOTFILES $x" done case $1 in -F*|-f*) shift ; x=`uname -a | cut -d@ -f2 | cut -d: -f2 | cut -d' ' -f1` mykernel="/sys/i386/conf`expr $x : '/usr/src/sys/compile\(.*\)'`*" ROOTFILES="$ROOTFILES $mykernel /var/mail" ; INTERACTIVE=0 ; echo "Making full snap:" ; for x in $ROOTFILES ; do echo " $x" ; done echo ;; esac # any remaining command line parameter is a destination directory to hold # the snapshot OLD_DIR=`pwd` if [ -n "$1" ] ; then cd $1 shift fi ARCHIVE="`hostname -s`.tar" #-------------------------------------------------------------------------# echo " Saving system configuration file $ARCHIVE in area `pwd`" # Only let original /etc files (e.g. fstab) overwrite # the new system's /etc files if the user insists. if [ $INTERACTIVE = 1 ] ; then echo " When extracting the configuration files onto the new host, do you want to overwrite that host's important /etc files {fstab, exports, *.conf, ...)? If you do not overwrite, the original files will instead be copied into / for you to manually merge into the system's default /etc files later. Enter Y or N, or return for default N which is the SAFEST." read answer else answer=Y fi case $answer in [yY]*) TABFILES="/etc/fstab"; test -f /etc/exports && TABFILES="$TABFILES /etc/exports*"; CDCMD=""; break;; *) TABFILES="-C /etc fstab"; test -f /etc/exports && TABFILES="$TABFILES -C /etc exports*"; CDCMD="-C /etc"; break;; esac echo " " #-------------------------------------------------------------------------# # get system configuration files x="/etc/aliases* /etc/*config* /etc/disktab* /etc/fstab.* /etc/gettytab* /etc/inetd.conf* /etc/netstart* /etc/rc.local* /etc/shells* /etc/syslog.conf* /etc/ttys*" if [ -n "$x" ] ; then echo " " for y in $x ; do if [ x$CDCMD = x ] ; then TABFILES="$TABFILES $y" else TABFILES="$TABFILES $CDCMD `expr $y : '/etc/\(.*\)'`" fi done fi # Collect PC support tools: PC NFS test -f /etc/pcnfsd.conf && MISCF="$MISCF /etc/pcnfsd.conf*" #-------------------------------------------------------------------------# # Pick up this host's at jobs Q and take a copy of root's crontab ATJOBS="/var/at/jobs /var/cron/tabs" # Include any DOS file system mount points #test -d /dos && MISCF="$MISCF /dos" # NIS ypserv network specification + NIS files test -f /var/yp/securenets && MISCF="$MISCF /var/yp/securenets*" test -d /etc/yp && MISCF="$MISCF /etc/yp" # TCP wrappers security filtering test -f /usr/etc/tcpd && MISCF="$MISCF /usr/etc/tcpd" # ftp welcome message file test -f /etc/ftpwelcome && MISCF="$MISCF /etc/ftpwelcome" #-------------------------------------------------------------------------# # Copy soft links ##1 /var/db/pkg might be a soft link if the database for installed ## packages is kept on a file system (with the actual packages). ##2 material such as /compat might also be kept on a separate file ## system so we copy it if it is a link ##3 misc. X11 soft links for x in /usr/local /usr/X* /usr/gnu* /compat /var/db/pkg \ /usr/bin/X11* /usr/include/X11* /usr/lib/X11* ; do test -h $x && OURLINKS="$OURLINKS $x" done #-------------------------------------------------------------------------# # save /usr/local/etc files test -d /usr/local/etc && MISCF="$MISCF /usr/local/etc" #-------------------------------------------------------------------------# # Copy any X configuration files MISCF="$MISCF $XHOME/lib/X11/X*onfig*" #-------------------------------------------------------------------------# # Create the archive ### (ignoring /etc/*name* ) ### ( /etc/default* ) # echo "Using tar to create the archive $ARCHIVE ..." tar cvf $ARCHIVE \ /etc/*passwd* \ /etc/*pwd.db* \ /etc/host* \ /etc/group* \ /etc/net* \ /etc/protocols* \ /etc/resolv.conf* \ /etc/sendmail.cf* \ /etc/printcap* \ $ETCFILES \ $ROOTFILES \ $ATJOBS \ $OURLINKS \ $MISCF \ $TABFILES echo "Now compressing $ARCHIVE ... " /bin/rm -f $ARCHIVE.gz gzip --best $ARCHIVE ls -al $ARCHIVE.gz if [ $INTERACTIVE = 1 ] ; then echo ' Would you like to copy file '$ARCHIVE'.gz onto the floppy drive? Enter Y or N, or return for default which is not to bother.' while :; do read answer x="tar cvf /dev/rfd0a $ARCHIVE.gz" case $answer in [yY]*) echo $x ; eval $x ; break;; *) echo 'Write the floppy with command:'; echo " $x"; break;; esac done else echo "Created archive: `ls -l $ARCHIVE.gz`" fi cd $OLD_DIR ########################################################################### # end of script ########################################################################### -- ------------------------------------------------------------------------ Dr Phillip Musumeci __ /\ Postal Address: Telephone: / \/ \ Dept. of Computer Systems Engineering ++61 3 96605317(w1) / \ RMIT ++61 3 96605383(w2) / / GPO Box 2476V ++61 3 96605340(fax) \ __ / Melbourne VIC 3001. AUSTRALIA RMIT Building 87.2.15, `-' \*/ EMAIL: phillip@cse.rmit.edu.au 410 Elizabeth Street. . WWW: http://www.cse.rmit.edu.au/~rdspm ------------------------------------------------------------------------ A good environment for the teaching of "modern" microprocessors? One where the students were conceived *before* the microprocessor. --pm