LDP/LDP/howto/docbook/Linux-Complete-Backup-and-R.../scripts/cooked/back.up.all.ssh

45 lines
1.8 KiB
Plaintext

<![ CDATA [#! /bin/sh
# Back up the entire system to another computer's drive. To make this
# work, we need a convenient chunk of disk space on the remote
# computer. This version uses ssh to do its transfer, and compresses
# using bz2. This means this script has to know more about the other
# computer, which does not make for good modularization.
# Time-stamp: <2007-07-06 13:30:54 ccurley back.up.all.ssh>
# 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., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, 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/.
save="/backs/tester"
backup_server="charlesc"
# rotate the old backups. Do it all in one line to minimze authentication overhead.
ssh $backup_server "rm $save/tester.tar.old.bz2; mv $save/tester.tar.bz2 \
$save/tester.tar.old.bz2"
# save everything except /mnt, /proc, and squid directories.
time tar cf - / --exclude /mnt --exclude /proc --exclude /var/spool/squid\
| ssh $backup_server "bzip2 -9 > $save/tester.tar.bz2"
]]>