Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 10-04-2006, 06:43 AM   #1
Registered: Feb 2005
Location: New Zealand
Distribution: Debian, Ubuntu
Posts: 46

Rep: Reputation: 15
Question Automatic backup to email

Hey there,

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?..

Any pointers?

Old 10-04-2006, 06:47 AM   #2
Registered: Sep 2003
Location: Melbourne, Australia
Distribution: NetBSD 3.0.1, Slackware 10.1
Posts: 394

Rep: Reputation: 30
You can try something like this:

mail -s "Backup Files" -a /path/to/file


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Automatic FTP Backup aquaboot Linux - Software 5 06-03-2006 07:34 PM
Automatic backup of specified directories? Spreegem Debian 3 07-29-2005 12:08 AM
Automatic backup over LAN synecdoche Linux - General 1 06-12-2004 02:21 AM
Automatic Backup? Mirra? naloxone Linux - Software 0 04-28-2004 05:27 AM
Automatic Email lesath Linux - General 3 04-30-2001 06:24 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:05 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration