1

I've been having an issue where I'll see many instances of a particular process:

/usr/sbin/sendmail -FCronDaemon -i -odi -oem -oi -t

I've done a bit of reading and it seems like the processes are starting up to send out the stdout output of a cron job, but for some reason never terminate.

There's one process per day, so it believe it's related to the daily cron jobs. The start time of the process in ps aux (04:01 daily) seems to coincide with the kick-off time for the daily cron jobs (04:02 daily). The contents of /etc/cron.daily are:

0anacron  0logwatch  cups  logrotate  makewhatis.cron  mlocate.cron  rpm  tmpwatch

The contents of /etc/crontab are:

SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/
 # run-parts
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly

So far, I've manually killed these processes when they get to large numbers; if I don't, the server runs out of resources and the service running on it stops. Worst case, I'll simply set up another cron that kills these processes, but I'd rather stop the problem at the source. Does anyone know the cause for this issue? Can anyone provide steps to debug?

2
  • The mail log may be informative, or what mailq and mailq -Ac show stacked up, if anything.
    – thrig
    Apr 20 '16 at 16:46
  • Both commands show 0 total requests.
    – jwan
    Apr 20 '16 at 17:02
2

The issue wasn't rooted in sendmail at all. Using pstree, I was able to determine that there were many more processes that were also hanging, not terminating, and parented by crond. I looked through each of these processes and discovered that one process was doing something along the lines of

cat /var/log/some_log_file

When I did ls /var/log/some_log_file, I saw

/var/log/some_log_file|

some_log_file was actually a named pipe! It seems that the cron job was trying to read from this pipe, but never terminated because nothing was ever sent to the pipe.

As a fix, I deleted it and made it a regular file.

0

In my case, I had 5 five cron jobs and they were sending mail by default. So I needed to add this expression at the end of cron jobs.

>/dev/null 2>&1

For example:

*/5 * * * * /bin/sh /usr/share/shell/gnk-loader-rev2-20028-0027.sh > /dev/null 2>&1

You can find more information here or here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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