I'm trying to write some sort of script which will backup my database and webpage files, compress them into a bz2 file, then email them to me.
I know how to backup the database and I know how to add the files to a tar archive and compress them.
What I can't figure out is how to email this as an attachment to myself using bash scripting..
Here are the commands I'm using so far...
mysqldump -opt -h localhost --username=blah --password=blah --all-databases > backup.sql
tar -rvf backup.tar backup.sql
tar -rvf backup.tar /var/www
bzip2 -z backup.tar
Okay so now I'm left with a backup.tar.bz2 file.. and I'm trying to work out how to mail it to my gmail account through a bash script?..