send mail during cron job for sucessful task

Les Mikesell lesmikesell at gmail.com
Mon Dec 12 20:48:24 UTC 2005


On Mon, 2005-12-12 at 13:00, M E Fieu wrote:
> 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

Cron sends any output to stdout or stderr that you haven't redirected, 
regardless of success or failure of the command.  If you want some
mail, send something to stdout.  Either run a script that says what
you want as a wrapper around the command, or stop redirecting
stdout to a file and you'll get that by email.

-- 
  Les Mikesell
   lesmikesell at gmail.com





More information about the users mailing list