Seding email after successful mysqldump
Hello,
I've this script which takes backup of mysqldb through mysqldump. I need to send an automated email after success/failure mysqldump. How can add this feature in the script? Here's the script: Code:
#!/bin/sh |
You could go with the mail prog if its installed. Something like this should do the trick
Code:
mail -s "Dump completed" your-mail@address.com |
For a bit more detail in your email, you can do, e.g., the following
Code:
( echo "Subject: Dump completed"; |
Separate comment (and really a nitpick), you should reverse the order of:
mkdir `date '+%d-%m-%Y'` NOW=$(date +"%d-%m-%Y") And use the variable $NOW in the mkdir. These will happen so quickly that any problem is highly unlikely, but, in principle, the time could change between the two commands. Then your $NOW would fail to point to the directory that had been created. Partly it's just a matter of style and doing things the right way. In this case it's probably a one in a million chance of failure. |
All times are GMT -5. The time now is 06:32 AM. |