|
|
GNU/Linux Desktop Survival Guide by Graham Williams |
|
|||
Consider the situation of a collection of Debian boxes with no backup facilities as such, but there is an accessible machine with a proper backup regime. Access to the backed up machine is via ssh. The backup can be performed using a backup script which you create in /etc/cron.daily so that it will be executed each day (by default, 6:25am). The contents of the script are:
#!/bin/sh
#
# Script for /etc/cron.daily
#
LOGFILE="/root/BACKUP.log"
RSYNC="/usr/bin/rsync"
DEST="kayon@caravan.togaware.com:backup/$(/bin/hostname)"
OPTS="--rsh=ssh --cvs-exclude --archive --compress "
OPTS=${OPTS}"--delete --delete-excluded --verbose"
INCFILE="/etc/backup.include"
echo "===================================================" >> ${LOGFILE}
date >> ${LOGFILE}
echo "$RSYNC $OPTS --include-from ${INCFILE} / ${DEST}" >> ${LOGFILE}
$RSYNC ${TESTING} $OPTS --include-from ${INCFILE} / ${DEST} >> ${LOGFILE}
date >> ${LOGFILE}
echo "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^" >> ${LOGFILE}
The file /etc/backup.include might contain:
Since this is using ssh (OpenSSH, ssh protocol 2) and it is a cron job (i.e., you can not supply a password or passphrase), create a ssh public key for adding to kayon@caravan's authorized keys file:
Then the ssh connections will go straight through to kayon@caravan without the need to supply a password (or passphrase).
![]() Support this endeavour through your purchase of the PDF Version |
