Backup Users Home Directory
Depending on your bandwidth, the size of the directory and the location of the remote server, it can take an awful lot of time to make backups using this mechanism. For larger directories and lower bandwidth, use rsync to keep the directories at both ends synchronized.
##This is my first script to backup a users home folder on to remote server
# Change the values of the variables to make the script work for you:
# This creates the archive
tar cf $TARFILE $BACKUPFILES > /dev/null 2>&1
# First remove the old bzip2 file. Redirect errors because this generates some if the archive
# does not exist. Then create a new compressed file.
rm $BZIPFILE 2> /dev/null
# Copy the file to another host - we have ssh keys for making this work without intervention.
scp $BZIPFILE root@$SERVER:$REMOTEDIR > /dev/null 2>&1
# Create a timestamp in a logfile.
date >> $LOGFILE
echo backup succeeded >> $LOGFILE