how to stop emails sent by daily cron job
I have a server that sends me two emails each day to report that a couple of cron jobs have completed. I'd like to prevent the email from arriving but am not sure why it is even sent. Both are sent from "Cron Daemon <root@example.com" and The first has this as Subject:
Code:
Cron <root@domU-AA-BB-CC-DD-EE-FF> test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily ) Code:
/etc/cron.daily/webalizer: Code:
Cron <root@domU-AA-BB-CC-DD-EE-FF> php /var/www/cron/notify_expired_licenses.php > /var/www/cron/notify_expired_licenses.log Code:
PHP Notice: Undefined index: QUERY_STRING in /var/www/html/includes/foo.php on line 24 |
If a cron'ed program produces output that is not re-directed to a specified logfile (for stdout & stderr), then the output will be received by cron and emailed to the job owner (normally; if cron has an error it may email root instead).
I'd say you need to look at the scripts it's running and ensure the output is re-directed to a named log. BTW, the first one resembles the output generated by using the 'set' cmd in a shell script, usually used for debugging only. Eg, if you've got a shell script that is going wrong and you can't figure out why from the normal output, try this Code:
#!/bin/bash |
Thanks for your response. I've checked every script in the chain of execution and didn't find any echo statements or set commands link you described, but it would appear that the webalizer script has a "Quiet" setting in /etc/webalizer/webalizer.conf which is currently set to "no":
Code:
# The Quiet option suppresses output messages... Useful when run As for the other script, I should be able to modify the PHP script to get rid of the E_NOTICE errors. I've I have any trouble, I'll be checking back in. |
Quote:
Code:
#!/bin/bash -xv Also what are crontab entries for both these jobs. Such mails can be avoided by changing the '<command>' part in crontab. |
Hmmm. Thanks, Shivaa. Now that I look closer at /etc/cron.daily/webalizer, I see that the shebang has a -x flag. Do you think that could be it?
Code:
$ cat /etc/cron.daily/webalizer |
Quote:
Could you share crontab enties? |
This is in /etc/crontab:
Code:
$ cat /etc/crontab Code:
# m h dom mon dow command |
Quote:
Quote:
|
I believe I've fixed the PHP script so it shouldn't pose any more trouble I don't think.
I removed the -x flag on the webalizer script and it still insists on outputting a summary of records processed, but I think I can alter that quiet setting and I think that'll fix it. Thanks for the help! I'll know by tomorrow if I have it fixed. |
All times are GMT -5. The time now is 09:22 PM. |