]>
git.wh0rd.org - dump.git/blob - examples/remote_backup_ssh/backitup
4 # This script will backup local drives to a remote tape drive over ssh.
5 # written by David B. Peterson <dave@toppledwagon.com>
7 # Follow these steps before using it the first time:
8 # 1. Configure the env variables below, especially OPERATOR, TAPEHOST
9 # TAPEDEV, and FILESYSTEMS
10 # 2. run the following commands as root (on the machine to be backed up):
12 # cat ~/.ssh/id_dsa.pub | ssh OPERATOR@TAPEHOST 'cat - >> ~/.ssh/authorized_keys2'
14 # where OPERATOR and TAPEHOST are as you have defined below.
16 # We will run under screen so you can come back to the backup, if you need to.
17 if [ ! "$WINDOW" ]; then
22 # ssh-agent allows us to backup securely without entering the passphrase so
23 # many times. This version uses openssh v2.9
24 if [ ! $SSH_AGENT_PID ]; then
25 echo Starting ssh-agent...
26 exec ssh-agent
-- /bin
/sh
$0
31 TAPEHOST
=tapehost.example.com
36 DUMP
='/sbin/dump 0auf'
37 LOGDIR
=/var
/log
/backup
38 FILESYSTEMS
='hda1 hda7 hda6 hda5 hda10'
40 #### config above ####
41 # backup FILESYSTEMS to the TAPEDEV on TAPEHOST with DUMP as OPERATOR using RSH
44 mkdir
-p $LOGDIR &> /dev
/null
47 echo "Rewinding tape..."
48 REWIND
="mt -f $TAPEDEV rewind"
49 $RSH $OPERATOR@
$TAPEHOST $REWIND
51 for FS
in $FILESYSTEMS
53 $DUMP $OPERATOR@
$TAPEHOST:$TAPEDEV /dev
/$FS 2>&1 |
tee $LOGDIR/$FS.
$DATE
56 echo "Rewinding and ejecting tape..."
57 OFFLINE
="mt -f $TAPEDEV offline"
58 $RSH $OPERATOR@
$TAPEHOST $OFFLINE