On Fri, 19 Jun 1998, Jay Barbee wrote: > I was wondering how I would use AFIO to replace they way I use tar. > Here is a sample: > > tar c -X /root/backup/exclude -f /mnt/scratch/linux/backup.tar / > > What I do not know how to do is exclude several file which are listed > in the file "exclude" which looks like: > > --- > /cdrom > /home/public/old-system-backup/* > cache* > core > --- > > The TAR command works, but I cannot figure out how to use AFIO in the same > manner.
here's a simple shell script i wrote before i found the afbackup program. note: i've updated it slightly to use the 'tempfile' command. i believe that this command is only available in hamm. modify as required if you're not using hamm play with this, it will do what you want....however, i strongly recommend that you investigate the afbackup package. it can do full and incremental backups - it's a complete backup system, whereas this script is just a quick-and-dirty hack to get the job done. ---cut here--- /usr/local/bin/afio.backup --- cut here--- #! /bin/sh # by Craig Sanders. This script is hereby placed in the public domain. # do whatever you want with it, i don't care :) TAPE=/dev/st0 LIST=$(tempfile) if [ "$1" = "--erase" ] ; then mt -f $TAPE erase fi # list of directories to exclude from the backup EXPATHS="/proc /dev /cdrom /dos /mnt \ /tmp /usr/tmp /var/tmp \ /var/spool/news /var/spool/squid \ /usr/src/linux" # Convert into the form of a regex that find can use. EXCLUDE=$( echo $EXPATHS | \ sed -e 's,^,\\\(^,' -e 's, ,$\\\)\\\|\\\(^,g' -e 's,$,$\\\),' ) # now construct the list of files to backup... find / -regex "$EXCLUDE" -prune -o -print | sort > $LIST # and finally, do the backup! cat $LIST | afio -o -c 512 -s 149m -v -z -L /tmp/afio.log -Z -G 9 $TAPE # now clean up rm -f $LIST mt -f $TAPE offline ---cut here--- /usr/local/bin/afio.backup --- cut here--- craig -- craig sanders -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]