LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 06-16-2011, 09:56 AM   #1
joseph_k
Member
 
Registered: Aug 2001
Location: North Dakota (USA)
Distribution: Ubuntu
Posts: 43

Rep: Reputation: 15
unable to disable cron email


I have tried the MAILTO="" and adding >/dev/null 2>&1 to the end of the line, but my server is still sending an email about my cron.weekly script. After making changes to /etc/crontab I restart cron with /etc/init.d/cron restart without error. I have also tried crontab -e but that loads up an empty file (su'ed into root). What step am I missing / what am I doing wrong?

Here's my crontab:

Code:
# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file.
# This file also has a username field, that none of the other crontabs do.

MAILTO=""
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# m h dom mon dow user  command
17 *    * * *   root    run-parts --report /etc/cron.hourly
25 6    * * *   root    test -x /usr/sbin/anacron || run-parts --report /etc/cron.daily
47 6    * * 7   root    test -x /usr/sbin/anacron || run-parts --report /etc/cron.weekly > /var/log/StopSendingEmail.log
52 6    1 * *   root    test -x /usr/sbin/anacron || run-parts --report /etc/cron.monthly
#
 
Old 06-16-2011, 10:21 AM   #2
jason_not
Member
 
Registered: Aug 2010
Location: Beaverton, Oregon, USA
Distribution: Pfsense, Ubuntu, Centos, Fedora, Redhat, Scientfic, MacOS
Posts: 76

Rep: Reputation: 19
Hi,

I would first start by looking in all of the crontab files: on ubuntu the crontabs are stored in /var/spool/cron/crontabs. Next, is there a directory like /etc/cron.d to put arbitrary crontabs in?

When you say you added ">/dev/null 2>&1" to the end of the line, do you mean the cron.weekly line in /etc/crontab? Is there anything in the cron.weekly file that might be generating output? Do the contents of the emails themselves actually change? (not the data, just the form...)

Also, is it possible cron is generating output to syslog and it's syslog that's sending the weekly output?

A way you can simulate the operating environment of cron is to setup an "at" job: have "at" run the cron file so you can force it. YOu might even run strace on the cron script to see what the system is doing. I use strace all the time to find out what scripts are actually doing.

--jason
 
Old 06-16-2011, 12:57 PM   #3
joseph_k
Member
 
Registered: Aug 2001
Location: North Dakota (USA)
Distribution: Ubuntu
Posts: 43

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by jason_not View Post
Hi,

I would first start by looking in all of the crontab files: on ubuntu the crontabs are stored in /var/spool/cron/crontabs. Next, is there a directory like /etc/cron.d to put arbitrary crontabs in?
there are not files in the /var/spool/cron/crontabs. I have a directory /etc/cron.d/ which contains 2 files: anacron and sendmail.

Quote:
When you say you added ">/dev/null 2>&1" to the end of the line, do you mean the cron.weekly line in /etc/crontab? Is there anything in the cron.weekly file that might be generating output?
Yes, at the end of the weekly command. In the copy I posted above, I am trying to redirect the output to a file (/var/log/StopSendingEmail.log). The messages are definitely from my script that is in the cron.weekly folder.

Quote:
Do the contents of the emails themselves actually change? (not the data, just the form...) Also, is it possible cron is generating output to syslog and it's syslog that's sending the weekly output?
It's the same messages, once a week:

To: root@localhost
Subject: Anacron job 'cron.weekly' on fccu-proxy

/etc/cron.weekly/copyproxylog:
tar: Removing leading `/' from member names
tar: Removing leading `/' from member names
Restarting DansGuardian: dansguardian.


Quote:
A way you can simulate the operating environment of cron is to setup an "at" job: have "at" run the cron file so you can force it. YOu might even run strace on the cron script to see what the system is doing. I use strace all the time to find out what scripts are actually doing.

--jason
when i manually run the script (that is in the /etc/cron.weekly folder), the messages I normally get in the email are printed to the screen and no email goes out.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to launch email clients by clicking email links KDE 4.5.2-alien -Current damgar Slackware 3 10-21-2010 05:01 PM
[SOLVED] Email output of Cron command, sends email but no content? the182guy Linux - Newbie 4 05-28-2010 09:52 AM
What does this cron job do? disable it or change its frequency lindylex Linux - General 3 11-29-2009 01:40 AM
disable cron from logging to syslog akudewan Linux - General 6 07-07-2008 09:29 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:50 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration