send mail during cron job for sucessful task
Charles Heselton
charles.heselton at gmail.com
Mon Dec 12 20:17:02 UTC 2005
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Not sure how you have it set up, but from my experience, cron emails
you any output from the job. So if you wrapped your mysqldump in a
bash script that checked the status of the last command and printed a
message, you could get a response from a successful job.
For example, put this in a script:
#!/bin/bash
mysqldump -u bugsroot DB1 > /home/bugsroot/db1.bak
if [[ $? -eq 0 ]] ;then
echo "MySQLDump was successful."
else
echo "Problems with MySQLDump."
fi
Then, change your cronjob to:
MAILTO="david at abc.com"
0 18 * * * /home/bugsroot/mysql_dump.sh
- --
- - Charlie
5A27 58D2 C791 8769 D4A4 F316 7BF8 D1F6 4829 EDCF
In memoriam: http://www.militarycity.com/valor/1029976.html
> -----Original Message-----
> From: fedora-list-bounces at redhat.com
> [mailto:fedora-list-bounces at redhat.com] On Behalf Of M E Fieu
> Sent: Monday, December 12, 2005 11:00 AM
> To: fedora-list at redhat.com
> Subject: send mail during cron job for sucessful task
>
> Hey, I have the crontab setting up as following, whenever the
> job fail it will send email to me at
> david at abc.com. but if the job is successful, it won't send
> mail. Is there any way to send mail to
> me even it is a successful task ??
>
> MAILTO="david at abc.com"
> 0 18 * * * mysqldump -u bugsroot DB1 > /home/bugsroot/db1.bak
>
> -----Original Message-----
> From: Cron Daemon [mailto:root at w2.abc.com]
> Sent: Monday, December 12, 2005 6:00 PM
> To: david
> Subject: Cron <bugsroot at w2> mysqldump -u bugsroot DB1 >
> /home/bugsroot/db1.bak
>
> mysqldump: Got error: 1045: Access denied for user:
> 'bugsroot at localhost' (Using password: YES)
> when trying to connect
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
> --
> fedora-list mailing list
> fedora-list at redhat.com
> To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
-----BEGIN PGP SIGNATURE-----
Version: PGP 8.1
iQA/AwUBQ53avnv40fZIKe3PEQIFlQCgsukFObpJ10KgmEhULhDNGkOi0UcAnRW1
tW4oHUf3CZUi03SOHLrHJ5Px
=iTbU
-----END PGP SIGNATURE-----
More information about the fedora-list
mailing list