LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-21-2013, 06:51 AM   #1
gacanepa
Member
 
Registered: May 2012
Location: San Luis, Argentina
Distribution: Debian
Posts: 204

Rep: Reputation: 27
Question Understanding automatic daily email from cron


Hi everyone,
I keep receiving this email everyday from root at my local Debian system:
Code:
From root@localhost  Mon Jan 21 06:26:54 2013
X-Original-To: root
From: root@localhost (Cron Daemon)
To: root@localhost
Subject: Cron <root@debian> test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily ) (failed)
Content-Type: text/plain; charset=UTF-8
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin>
X-Cron-Env: <HOME=/root>
X-Cron-Env: <LOGNAME=root>
Date: Mon, 21 Jan 2013 06:26:53 -0300 (ART)

/etc/cron.daily/mdadm:
mdadm: No mail address or alert command - not monitoring.
run-parts: /etc/cron.daily/mdadm exited with return code 1
And this is what's in my crontab:
Code:
30 05 * * * /home/gacanepa/scripts/Bash/system_report.sh > /home/gacanepa/scrip$
@reboot /home/gacanepa/scripts/Bash/getPublicIP.sh > /dev/null 2>&1
None of those entries have anything to do with the automatic email I am receiving each day, which leaves me wondering as to its origin.
NOTE: I have a RAID1 mirror installed in my system (that is the only thing I can think of since the email mentions mdadm).
 
Old 01-21-2013, 06:59 AM   #2
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
As you can see, this mail has sent from root user, so whose crontab entry did you check - your own or root's?

To check root's crontab enrties, switch to root user and invoke:
Code:
~$ su - root
~# crontab -l
And it's not necessory that mail command is mentioned in crontab entry only, but it can be in your script also.

I think this mail is sent using mailx command, so once check inside those script as:
Code:
~$ grep 'mailx' scriptname
 
Old 01-21-2013, 07:32 AM   #3
gacanepa
Member
 
Registered: May 2012
Location: San Luis, Argentina
Distribution: Debian
Posts: 204

Original Poster
Rep: Reputation: 27
Quote:
Originally Posted by shivaa View Post
As you can see, this mail has sent from root user, so whose crontab entry did you check - your own or root's?

To check root's crontab enrties, switch to root user and invoke:
Code:
~$ su - root
~# crontab -l
And it's not necessory that mail command is mentioned in crontab entry only, but it can be in your script also.

I think this mail is sent using mailx command, so once check inside those script as:
Code:
~$ grep 'mailx' scriptname
Much to my surprise, there are no entries in root's crontab:
Code:
root@debian:~# crontab -l
# Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').#
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
#
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
#
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
# For more information see the manual pages of crontab(5) and cron(8)
#
# m h  dom mon dow   command
root@debian:~#
The script that is mentioned in my crontab is indeed using the mail (or mailx command, as they're equivalent according to mail's manpage) but I NEVER check for the RAID1 status. That's why I was a little confused about mdadm being mentioned in the automatic email.
 
Old 01-21-2013, 07:51 AM   #4
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
Quote:
Originally Posted by gacanepa View Post
The script that is mentioned in my crontab is indeed using the mail (or mailx command, as they're equivalent according to mail's manpage) but I NEVER check for the RAID1 status. That's why I was a little confused about mdadm being mentioned in the automatic email.
What's mail/mailx command mentioned in your script? In case if root's crontab is empty then there should be a from option mentioned in mail/mailx command. I am not sure, but may be someone else has added this script/mail option in your script..

Anyway, if you don't want to receive such mails, then comment out (just put a # against mail or mailx in your script) those lines in your script.

Last edited by shivaa; 01-21-2013 at 07:52 AM.
 
Old 01-21-2013, 08:40 AM   #5
gdejonge
Member
 
Registered: Aug 2010
Location: Netherlands
Distribution: Kubuntu, Debian, Suse, Slackware
Posts: 317

Rep: Reputation: 73
Quote:
Originally Posted by gacanepa View Post
/etc/cron.daily/mdadm:
mdadm: No mail address or alert command - not monitoring.
run-parts: /etc/cron.daily/mdadm exited with return code 1
This is what is going on.
First line is telling what script was running.
Second line is telling what the real problem is.
Third line is run-parts telling you that one of the scripts it was executing gave an error.

Some explanation: run-parts is a script that is started by the anacron program to execute all scripts/programs in a specific directory. In this case /etc/cron.daily.
You will also find a /etc/cron.hourly (which will be executed every hour) and /etc/cron.monthly (executed once a month)
 
1 members found this post helpful.
Old 01-21-2013, 08:43 AM   #6
gacanepa
Member
 
Registered: May 2012
Location: San Luis, Argentina
Distribution: Debian
Posts: 204

Original Poster
Rep: Reputation: 27
Quote:
Originally Posted by gdejonge View Post
This is what is going on.
First line is telling what script was running.
Second line is telling what the real problem is.
Third line is run-parts telling you that one of the scripts it was executing gave an error.

Some explanation: run-parts is a script that is started by the anacron program to execute all scripts/programs in a specific directory. In this case /etc/cron.daily.
You will also find a /etc/cron.hourly (which will be executed every hour) and /etc/cron.monthly (executed once a month)
Thanks! This was VERY helpful! I will mark this thread as solved and add to your reputation right now .
 
  


Reply


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
[SOLVED] /etc/cron.daily/slocate.cron - multiple /usr/bin/updatedb degrades performance ray63 Linux - Server 2 01-05-2012 06:04 PM
cron - how to give priority to a task running in cron.daily? MeeLee Linux - Newbie 3 11-09-2010 09:41 AM
adding a perl script to cron.daily / cron.d to setup a cron job CrontabNewBIE Linux - Software 6 01-14-2008 09:16 AM
cron hourly, daily, cron.d jobs don't execute eggsmartha Linux - General 3 09-17-2007 07:37 PM
Can any one plz explain why/what for cron.d, cron.daily, cron.weekly etc are there. mavinashbabu Linux - Newbie 4 09-21-2006 02:50 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:15 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration