LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 09-03-2009, 05:36 AM   #1
garydale
Member
 
Registered: Feb 2007
Posts: 122

Rep: Reputation: 22
Debian/Lenny - user cron jobs sending status e-mails


Some time ago I lost e-mail send capability on a remote server - probably when I upgraded to Lenny. Yesterday I finally got around to visiting it and got the capability back (the router has a dynamic IP address so I needed to find out what it was to connect remotely - I have a job on the server that had been e-mailing me when it changed).

Anyway, I'm now getting an e-mail message each time a cron job completes. Now I appreciate getting error messages sent to me, but is there a way I can turn off e-mail when a job terminates normally?

Specifically I have three jobs that are run as root through crontab (in addition to the anacron jobs Debian places there, which are also run as root). One runs hourly so I'm getting 24 e-mails a day telling me that it worked. The other two are run overnight once per day, so they are not so annoying but one already sends me e-mails when it fails, while the other I don't care if it succeeded or not.
 
Old 09-03-2009, 07:20 AM   #2
garydale
Member
 
Registered: Feb 2007
Posts: 122

Original Poster
Rep: Reputation: 22
more information

It occurs to me that I left out some important details:
1) this is a new thing. It never used to happen
2) the sender is Cron Daemon <root@eol.ca>
3) the subject line is, for example,
Cron <root@dellbert> /root/check-ip.sh

where eol.ca is the isp handling mail from that server, dellbert is the server name and /root/check-ip.sh is the script cron runs every hour (the other two scripts give similar messages).

The body of the messages are any error messages that were generated, or some statistics (possibly from the router on the check-ip.sh script).
 
Old 09-03-2009, 07:47 AM   #3
garydale
Member
 
Registered: Feb 2007
Posts: 122

Original Poster
Rep: Reputation: 22
Smile never mind

Located the source of the problem. My hourly job uses curl to log into the router (using a non-privileged account) and extract its current external ip address. Curl by default writes status information to the console, in addition to the output that goes to stdout. I suspect that the cron daemon is taking that as error information and sending me a notification. I've switched curl to operate in silent mode so that should take care of the problem.

Another script usually fails - that is what it should do - so I've removed it as not being necessary for now until I change it to not generate errors.

The third script actually did report a legitimate error that I've now addressed.

Hopefully the volume of e-mail from that server should decrease.
 
Old 09-03-2009, 11:37 PM   #4
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,261

Rep: Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028
The devil is in the details, as usual
 
Old 09-04-2009, 12:54 PM   #5
canyonbreeze
LQ Newbie
 
Registered: Apr 2009
Posts: 18

Rep: Reputation: Disabled
Related note: A lot of the cron job scripts can use a log file instead of an email address. Cuts the email way down.
 
  


Reply

Tags
cron, crontab, email, status


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
LXer: A Debian Lenny status report for the $0 Laptop LXer Syndicated Linux News 0 07-02-2008 05:10 PM
User Cron Jobs Won't Run - Pulling Hair Out rhugga Linux - Enterprise 2 08-05-2007 11:52 PM
SuSE 9.2 cron jobs as regular user vic_semionov Suse/Novell 0 12-05-2004 06:28 AM
Can't run cron jobs as user, only root Kropotkin Linux - Newbie 5 11-10-2004 09:30 AM
Sending Mail via cron every hour without user input. cpope67 Linux - Software 1 10-25-2004 01:55 PM


All times are GMT -5. The time now is 12:13 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration