mdadm cron job sends email that cron has run

Posted by Andrew on Server Fault See other posts from Server Fault or by Andrew
Published on 2010-05-07T04:09:14Z Indexed on 2010/05/07 4:18 UTC
Read the original article Hit count: 584

Filed under:
|
|
|

I've got an Ubuntu 8.04 server using mdadm to create several RAID1 arrays. I created /etc/cron.hourly/mdadm as follows:

#! /bin/sh

set -e

mdadm --monitor /dev/md0 /dev/md3 /dev/md4 --oneshot

(Yes, the array numbers are not sequential, and I'm not using --scan beacuse I have a degraded array that may or may not have been used as swap and I can't delete, but I think that's a separate issue. If it's the underlying cause of this, I need to fix it.)

mdadm sends me email (configured in the /etc/mdadm/mdadm.conf) on DegradedArray etc. events. This is the desired behaviour. What is not desired, and I can't work out, is why cron is sending me (relatively pointless) emails, via an alias in /etc/aliases:

From: root@<hostname> (Cron Daemon)
To: root@<hostname>
Subject: Cron <root@<hostname>>    cd / && run-parts --report /etc/cron.hourly
Content-Type: text/plain; charset=ANSI_X3.4-1968
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>
Message-Id: <id@hostname>
Date: Fri,  7 May 2010 13:17:01 +0930 (CST)

/etc/cron.hourly/mdadm:
mdadm: Monitor using email address "<root_alias@domain>" from config file

I've got a dozen other servers behaving correctly (mdadm sends email, cron doesnt') with identical /etc/crontab files:

# /etc/crontab: system-wide crontab
# <snip comments>

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    cd / && run-parts --report /etc/cron.hourly
<snip anacron jobs>

Should I simply remove the --report, or is there something else in my cron config somewhere causing this?

© Server Fault or respective owner

Related posts about mdadm

Related posts about cron