LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 10-04-2006, 05:43 AM   #1
critical
Member
 
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...

Code:
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?

Cheers
 
Old 10-04-2006, 05:47 AM   #2
Kristijan
Member
 
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:

Code:
mail -s "Backup Files" -a /path/to/file you@gmail.com
-Kristijan
 
  


Reply



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 06:34 PM
Automatic backup of specified directories? Spreegem Debian 3 07-28-2005 11:08 PM
Automatic backup over LAN synecdoche Linux - General 1 06-12-2004 01:21 AM
Automatic Backup? Mirra? naloxone Linux - Software 0 04-28-2004 04:27 AM
Automatic Email lesath Linux - General 3 04-30-2001 05:24 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:55 AM.

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