[SOLVED] Understanding automatic daily email from cron
Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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).
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.
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.
/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)
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 .
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.