Page 1 of 1

Cron job to e-mail database - is it possible

Posted: Mon Dec 06, 2010 5:07 pm
by eurocms
I got my cron job set to backup the database on a weekly basis (using Webmin).  What I'd like to do is to set a cron job to grab the file and then e-mail it out.  Is it possible?
Thanks much!

Re: Cron job to e-mail database - is it possible

Posted: Mon Dec 06, 2010 5:19 pm
by Wishbone
If your hosting account is Linux, and you have access to uuencode, you can do the following in your cron entry:

uuencode /path/to/my-backup.sql backup.sql | mail -s "Backup" eurocms@your-domain.com

Your email applicatation will see the encoded information and show it to you as an attachment.

http://www.shelldorado.com/articles/mai ... ments.html

Re: Cron job to e-mail database - is it possible

Posted: Mon Dec 06, 2010 5:25 pm
by Wishbone
uuencode output is quite a bit larger than the actual file. To send the actual file as a MIME attachment, you can use 'mutt' if you have that installed

mutt -s "Backup" -a /path/to/my-backup.sql eurocms@your-domain.com < /dev/null