I remember messing around with crontab and setting up email capabilities on a server many months back, and now all of a sudden I'm getting the following email:
EMAIL HEADER:
from: root <[email protected]>
to: root
date: Thu, Dec 5, 2013 at 6:48 AM
subject: Cron <root@server-ip> test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
mailed-by: gmail.com
EMAIL BODY:
/etc/cron.daily/mlocate:
/usr/bin/updatedb.mlocate: `/var/lib/mlocate/mlocate.db' is locked (probably by an earlier updatedb)
run-parts: /etc/cron.daily/mlocate exited with return code 1
This is on Ubuntu Server 12.04.1 LTS. I don't even know which email server I'm using or how to find out. My understanding of the /etc/cron.daily
directory must be off, because when I do crontab -l
(for both root and my regular user) it says there is no crontab.
Maybe it's an issue with updatedb
and not email or cron?
EDIT:
I've killed off the /bin/bash /etc/cron.daily/mlocate
and /usr/bin/updatedb.mlocate
processes and removed the lock, now I'll just have to wait to see if I get the error again.
/etc/cron.daily/mlocate
and that script is erroring, you should probably fix that.The previous posters have completely missed the mark!
First of all, the original poster clearly said which OS he is using: Ubuntu Server 12.04.1 LTS
Second of all, it helps to understand system-level processes in a UNIX-type system. System level cron tables are setup to run housekeeping processes at regularly scheduled times. Since a cron job has no connected terminal to output error messages to, they are emailed to the cron-tab's user -- in this case the system administrator.
Third, You should not just turn off the emailing of these messages, or turn off the processing of the cron jobs. They are an indication that there is a problem, and you need to address the root cause.
In the case of this particular message, I too started receiving them after performing a regular upgrade that involved mlocate. The process got stalled and unable to finish waiting for an I/O operation to finish. Take a look at the process table:
The simplest solution is to just kill the process(es) involved and let the next cron scheduled time run it again later.
Please note that this will generate one single new cron message, as the stuck process is removed and cron sees that as an error:
That's an indication that you cleared things up, and now the next instance should work like normal.
/var/spool/cron/
and dogrep -ir MAILTO
, the same check forMAILTO
entries in the/etc/crontab
file.