#! /bin/sh # Back up another computer's drive to this system. To make this work, we # need a convenient chunk of disk space on this computer. This version # uses ssh to do its transfer, and compresses using bz2. This version was # developed so that the system to be backed up won't be authenticated to # log onto the backup computer. This script is intended to be used on a # firewall. You don't want the firewall to be authenticated to the backup # system in case the firewall is cracked. # Time-stamp: <2004-04-03 12:24:12 ccurley get.tester> # Copyright 2000 through the last date of modification Charles Curley. # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 2 of the License, or (at your # option) any later version. # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # You can also contact the Free Software Foundation at http://www.fsf.org/ # For more information contact the author, Charles Curley, at # http://www.charlescurley.com/. # 2004 04 03: added /sys to the list of excludes. It is a read-only # pseudo-file system like /proc. # 2002 07 01: We now set the path on the target to the zip drive with # a variable. This fixes a bug in the command to eject the zip disk. # 2002 07 01: The zip disk archives are now in bzip2 format, so this # script has been changed to reflect that. # The host name of the computer to be backed up. target=tester zip=/mnt/zip echo Backing up $target echo Aging the ZIP disk backups. rm -r $target.old.zip mv $target.zip $target.old.zip ssh $target "modprobe ppa ; mount -r $zip" echo Copying the ZIP disk. # -r for recursive copy, -p to preserve times and permissions, -q for # quiet: no progress meter. scp -qpr $target:$zip $target.zip du -hs $target.zip echo Aging the archives rm $target.tar.old.bz2 mv $target.tar.bz2 $target.tar.old.bz2 echo Backing up $target to the backup server. ssh $target tar -cf - / --exclude /sys --exclude /mnt --exclude /proc\ --exclude /var/spool/squid\ | bzip2 -9 | cat > $target.tar.bz2 echo Testing the results. find . -iname "*.bz2" | xargs bunzip2 -t ssh $target "eject $zip"