Results 1 to 3 of 3
if I run mysqldump from crontab and error occurs, I would like to have email send to me (reporting that backup is not working).
Can this be done ?...
- 01-22-2010 #1Just Joined!
- Join Date
- Jan 2010
- Posts
- 11
crontab mysqldump err mail
if I run mysqldump from crontab and error occurs, I would like to have email send to me (reporting that backup is not working).
Can this be done ?
- 01-26-2010 #2Just Joined!
- Join Date
- Jan 2010
- Posts
- 4
Should be doable. Something similar to the following should work ( not tested ):
Basically, the stuff after the '||' is only executed if the command before it returns a non zero exit code. A successful mysqldump should return 0 and therefore no email would be sent.Code:mysqldump --opt --user=mysqluser --password=secretpass dbname > dbname.sql || echo "mysqldump failure message" | mail -s 'mysqldump error' user@domain.com
Hope this helps.
- 01-26-2010 #3Just Joined!
- Join Date
- Jan 2010
- Posts
- 11
Thanks a lot, tested it and it works.
Didn't notice for a month that there are no 'usable' backups on
production server. By pure luck spoted that mysqldump generated files
were way to small.
No such problem in the future.


Reply With Quote