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!
Cron job to e-mail database - is it possible
Re: Cron job to e-mail database - is it possible
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
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
Last edited by Wishbone on Tue Dec 07, 2010 12:51 am, edited 1 time in total.
Re: Cron job to e-mail database - is it possible
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
mutt -s "Backup" -a /path/to/my-backup.sql eurocms@your-domain.com < /dev/null