Our goal is to accomplish the following:
1. Backing up your data to a Windows share.
(I do not show how to set up a share or mount that share. And I use rsync which will not be
covered here. Feel free to Google and then ask if you get stuck)
2. Updating a log of the time the backup occured.
3. Send an email to notify of successful backup.
(I used to use Perl but now use mutt...there are plenty of google pages for gmail configuration of mutt, so don't ask me)
First create the message of your body:
Type in what you want to get in your email, save and exit:
Data Backup Success!
Next create a bash script like so:
type the following, save and exit:
rsync -ra /your/files/to/be/backed/up /mnt/yourbackuplocation/
mutt -s "`date`" -- firstname.lastname@example.org < /location/of/message/
date >> /mnt/yourbackuplocation/backup_log
then make backups.sh executable:
chmod +x backups.sh
fyi backups.sh does the following:
-Syncs your files to a backup location you specify using the -r and -a tags which
-a, --archive archive mode; equals -rlptgoD (no -H,-A,-X)
-r, --recursive recurse into directoriesmore on rsync
-mutt emails you an email with the date and time to your email (mutt needs to be configured)
mutt and gmail
-appends the current date and time of script completion to file in your backup location
Setup cron to run your back up script at a designated time:
Then set it up like so: (example sets backup for 5 am every day)
0 5 * * * /bin/bash /location/of/backups.sh
The end result is that you have your data backed up daily, it keeps a log of it, and sends you an email daily letting you know it took place.
Thanks and have fun!