Help - Search - Members - Calendar
Full Version: To Disable Mail For Cron Jobs
Linuxhelp > Support > Technical Support
vaiharish
HI,
any body tell me how to disable sending mail for the cron job executed?
shlomifr
As far as I know, cron e-mails you only if the job writes anything to the standard output/error.
So you could redirect the output to /dev/null, and prevent cron from e-mailing you:

Example:

5 0 * * * /home/kuku/bin/my_script.sh >> /dev/null 2>&1

P.S.
====
You can alternatively, redirect the output inside the script itself:

Example:

my_script.sh:
---------------
#!/bin/sh

my_shell_command >> /dev/null 2>&1
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2017 Invision Power Services, Inc.