Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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 <myemail@gmail.com>
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.

share|improve this question
    
What have you tried so far to troubleshoot? –  yoonix Dec 6 '13 at 19:21

3 Answers 3

  1. It really helps if you specify what OS you're on. I'm guess this is some Linux distro...
  2. It's running /etc/cron.daily/mlocate and that script is erroring, you should probably fix that.
  3. I don't see a question anywhere in there.
share|improve this answer
    
Thanks, Chris... still getting used to the etiquette for StackExchange sites –  s g Dec 6 '13 at 19:45
  1. problem in the mlocate.
  2. messages sends directly from server-ip server.
  3. go to /var/spool/cron/ and do grep -ir MAILTO , the same check for MAILTO entries in the /etc/crontab file.
  4. if you do not want to receive messages from crond simply remove MAILTO string
  5. (probably by an earlier updatedb) <- if you started receiving messages today, then just give mlocate some more time to finish work on the server.
share|improve this answer

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:

$ ps -ef |grep mlocate
scott    14564 14416  0 19:49 pts/0    00:00:00 grep mlocate
root     16326 16113  0 Apr06 ?        00:00:00 /bin/bash /etc/cron.daily/mlocate
root     16332 16326  0 Apr06 ?        00:00:00 /usr/bin/updatedb.mlocate

The simplest solution is to just kill the process(es) involved and let the next cron scheduled time run it again later.

$ sudo kill -9 16326 16332

Please note that this will generate one single new cron message, as the stuck process is removed and cron sees that as an error:

From: root@XXXXXXX (Cron Daemon)
To: root@XXXXXXX
Subject: Cron <root@XXXXXXX> test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
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>
Date: Sun, 08 Apr 2014 19:54:36 -0400 (EDT)

run-parts: /etc/cron.daily/mlocate exited because of uncaught signal 9

That's an indication that you cleared things up, and now the next instance should work like normal.

share|improve this answer
    
Nice answer, +1 from me. But if you're going to take another user to task, best get your facts straight. Sure, the OP said he was on Ubuntu 12.04, but not until after Chris S asked him, at which point he edited his question to clarify the issue. You can see the datestamps in the edit history by clicking on the edited Datestamp at the bottom of the question. –  MadHatter Apr 14 at 6:54

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.