#!/bin/bash

#Setting some variable's for later

today =$ ( date + % d- % m- % y )

backup_name = "backup_ $today .tar.gz"

(

#Creating a backup of the home folder

tar -zcvf backup_ $today .tar.gz / home

#This will check if the backup is actually there

if [ -f " $backup_name " ]

then

echo " $backup_name found. Moving backup to remote server now"

#Move the file to the backup server using rsync

rsync -v -e ssh backup_ $today .tar.gz root @ server.com: / backup

else

echo " $backup_name not found, something went wrong :("

fi

) 2 >& 1 | tee backup.log

#Sending an email to let the admin know the backup is done