RE: send mail during cron job for sucessful task

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 
-----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@xxxxxxx"
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@xxxxxxxxxx 
> [mailto:fedora-list-bounces@xxxxxxxxxx] On Behalf Of M E Fieu
> Sent: Monday, December 12, 2005 11:00 AM
> To: fedora-list@xxxxxxxxxx
> 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@xxxxxxxx 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@xxxxxxx"
> 0 18 * * * mysqldump -u bugsroot DB1 > /home/bugsroot/db1.bak
> 
> -----Original Message-----
> From: Cron Daemon [mailto:root@xxxxxxxxxx] 
> Sent: Monday, December 12, 2005 6:00 PM
> To: david
> Subject: Cron <bugsroot@w2> mysqldump -u bugsroot DB1 > 
> /home/bugsroot/db1.bak
> 
> mysqldump: Got error: 1045: Access denied for user: 
> 'bugsroot@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@xxxxxxxxxx
> To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list

-----BEGIN PGP SIGNATURE-----
Version: PGP 8.1

iQA/AwUBQ53avnv40fZIKe3PEQIFlQCgsukFObpJ10KgmEhULhDNGkOi0UcAnRW1
tW4oHUf3CZUi03SOHLrHJ5Px
=iTbU
-----END PGP SIGNATURE-----


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux