Hi Folk,
This is how my rbackup.sh script file looks like. By the way for your
information, I am using rsync which I have installed and configured well
and as it stands, I can ssh to the remote machine without being asked for
the password and I was at the stage of automating the backup system by
making the rbackup.sh executable and then execute it.
Here is how my rbackup.sh script looks like. Probably you can help
spotting where I am going wrong. I am using SuSe to do all this;
------------------------------------------------
#!/bin/sh
# Author: Brice Burgess - [EMAIL PROTECTED]
# rbackup.sh -- secure backup to a remote machine using rsync.
# Directories to backup. Separate with a space. Exclude trailing slash!
SOURCES="/home/ahmed/Visionary"
# IP or FQDN of Remote Machine
RMACHINE=147.202.41.119
# Remote username
RUSER=deviear
# Location of passphraseless ssh keyfile
RKEY=/home/ahmed/rsync-key
# Directory to backup to on the remote machine. This is where your
backup(s) will be stored
# Exclude trailing slash!
RTARGET="/home/deviear/backp"
# Your EXCLUDE_FILE tells rsync what NOT to backup. Leave it unchanged,
missing or
# empty if you want to backup all files in your SOURCES. If performing a
# FULL SYSTEM BACKUP, ie. Your SOURCES is set to "/", you will need to make
# use of EXCLUDE_FILE. The file should contain directories and filenames,
one per line.
# An example of a EXCLUDE_FILE would be:
# /proc/
# /tmp/
# /mnt/
# *.SOME_KIND_OF_FILE
EXCLUDE_FILE="/path/to/your/exclude_file.txt"
# Comment out the following line to disable verbose output
# VERBOSE="-v"
#######################################
########DO_NOT_EDIT_BELOW_THIS_POINT#########
#######################################
if [ ! -f $RKEY ]; then
echo "Couldn't find ssh keyfile!"
echo "Exiting..."
exit 2
fi
if ! ssh -i $RKEY [EMAIL PROTECTED] "test -x $RTARGET"; then
echo "Target directory on remote machine doesn't exist or bad permissions."
echo "Exiting..."
exit 2
fi
echo "Verifying Sources..."
for source in $SOURCES; do
echo "Checking $source..."
if [ ! -x $source ]; then
echo "Error with $source!"
echo "Directory either does not exist, or you do not have proper
permissions."
exit 2
fi
done
if [ -f $EXCLUDE_FILE ]; then
EXCLUDE="--exclude-from=$EXCLUDE_FILE"
fi
echo "Sources verified. Running rsync..."
for source in $SOURCES; do
# Create directories in $RTARGET to mimick source directory hiearchy
if ! ssh -i $RKEY [EMAIL PROTECTED] "test -d $RTARGET/$source"; then
ssh -i $RKEY [EMAIL PROTECTED] "mkdir -p $RTARGET/$source"
fi
rsync $VERBOSE $EXCLUDE -a --delete -e "ssh -i $RKEY" $source/
[EMAIL PROTECTED]:$RTARGET/$source/
done
exit 0
------------------------------------
and reports an error on "line 53: syntax error near unexpected token 'do
for source in $SOURCE; do" which at this section;
echo "Verifying Sources..."
for source in $SOURCES; do
echo "Checking $source..."
if [ ! -x $source ]; then
echo "Error with $source!"
echo "Directory either does not exist, or you do not have proper
permissions."
exit 2
fi
done
I am eagerly waiting your assistance.
Ahmed
WEC Volunteer
iEARN-US
New York
that
_______________________________________________
LUG mailing list
[email protected]
http://kym.net/mailman/listinfo/lug
%LUG is generously hosted by INFOCOM http://www.infocom.co.ug/
The above comments and data are owned by whoever posted them (including
attachments if any). The List's Host is not responsible for them in any way.
---------------------------------------