[Novalug] Backup with rsync
Nino Pereira
pereira at speakeasy.net
Thu Jun 17 08:42:37 EDT 2010
Jim,
years ago a friendly, helpful, and knowledgeable NoVaLUGger made
me the following script, to back up one computer onto
others that I have. All have fixed IP addresses given in
the comments. This script has worked for years.
One thing I haven't figured out how to do is to run the
backup automatically. But, for now, this one works.
HTH,
Nino
#!/bin/bash
#
# backing up on a remote computer through ssh
#
# Data on computers available
# 66.92.144.240 (lithium, built by Dohn Arms, running debian)
# 66.92.144.133 (ibm, running Ubuntu 7.10 (gutsy Gibbon): carries web page
# the windows-XP machine is 66.92.144.90
# The double-core friendly Ubuntu machine is 66.92.144.89.
date
# back up onto lih
HOST=66.92.144.89
# Directory to be backed up: only my own stuff. Anything else
# can be reconstructed from the source. When you install a new
# system, back up anything you have configuration files for
# (like what???)
LOCALDIR=/home/pereira
# Directory to back up to:
# (this makes the files go to /home/pereira/pereira, for some reason,
# move them back to /home/pereira/ by going back to /home, and then do
# 'mv pereira/pereira pereira')
# REMOTEDIR=/home/pereira
# instead, try the following:
REMOTEDIR=/home/pereira/240
# (Contrary to the documentation, the environment must be
# given on the command-line of rsync).
# Set the environment variable RSYNC_RSH
RSYNC_RSH=ssh
# Backup $LOCALDIR to $REMOTEDIR on $HOST:
rsync --rsh=ssh --verbose --recursive --archive --compress $LOCALDIR
$HOST:$REMOTEDIR
#
# It is possible to run other backups, within this script, on
# subsequent lines.
# Copy /etc
date
LOCALDIR=/etc
# Directory to back up to.
REMOTEDIR=/home/pereira/240/etc
# (Contrary to the documentation, the environment must be
# given on the command-line of rsync).
# Set the environment variable RSYNC_RSH
RSYNC_RSH=ssh
# Backup $LOCALDIR to $REMOTEDIR on $HOST:
rsync --rsh=ssh --verbose --recursive --archive --compress $LOCALDIR
$HOST:$REMOTEDIR
#
pereira at lithium:~$
More information about the Novalug
mailing list