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

I have this strange mails comming from cron:

Return-Path: <root@domain.com>
Delivered-To: root@domain.com
Received: by domain.com (Postfix, from userid 0)
    id 6F944264D0; Mon, 10 Jan 2011 10:35:01 +0000 (UTC)
From: root@domain.com (Cron Daemon)
To: root@domain.com
Subject: Cron <root@domain> lynx -dump http://www.domain.com/cron/realqueue
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: <20110110103501.6F944264D0@domain.com>
Date: Mon, 10 Jan 2011 10:35:01 +0000 (UTC)

/bin/sh: lynx: not found

I have this cron settings in crontab file:

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin


*/5 * * * * lynx -dump http://www.domain.com/cron/realqueue

17 *    * * *   root    cd / && run-parts --report /etc/cron.hourly
25 6    * * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6    * * 7   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6    1 * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )

Lynx is installed on my Ubuntu as well.

Ofc in place of domain.com is my domain, just replaced.

Thanks ;)

share|improve this question

6 Answers 6

up vote 9 down vote accepted

You should check to make sure the lynx binary is in one of the locations specified in the PATH variable, or use the full path to the binary in the cron line. To surpress the errors, you want to redirect STDERR and STDOUT to /dev/null, like so:

*/5 * * * * lynx -dump http://www.domain.com/cron/realqueue >/dev/null 2>&1

The first redirection sends STDOUT to /dev/null, and the second sends STDERR with STDOUT (that is, to /dev/null).

share|improve this answer
    
Thanks realpath to lynx did the job. ;) –  Somebody Jan 12 '11 at 17:20

If you want the path to the lynx binary, the simplest command is which lynx.

That should give you something like /usr/bin/lynx

share|improve this answer

Add MAILTO to the top of your crontab and set it to a null string:

 MAILTO=""
share|improve this answer

The real issue here is this:

/bin/sh: lynx: not found

This is saying that lynx isn't found, and so that line in your crontab isn't even being run. Suppressing the errors using the redirection suggestions from Scrivener or blueben, you've just hidden the fact that the command you want to actually run isn't being run.

In general, cron will send those emails for error messages. The best way to suppress the emails is to fix the errors, and only if you can't fix the errors (eg, the script is always noisy) should you start to redirect output to /dev/null.

share|improve this answer
    
You didn't help him fix lynx or answer his question. –  blueben Jan 12 '11 at 18:33
1  
Fair call. Other answers (scrivener, nicola) have suggested ways to fix that though. I was really pointing out that blindly suppressing error notifications is not a fix. –  Daniel Lawson Jan 12 '11 at 21:36

maybe the lynx binaries are not registered in $PATH.

try this in your shell:

# locate lynx

it'll return some strings. Choose the one leads to lynx binaries and then do

# export PATH=$PATH:{the firstly returned string path until last dir}
share|improve this answer

You want:

*/5 * * * * lynx -dump http://www.domain.com/cron/realqueue >> /dev/null 2>&1

share|improve this answer
    
-1 for blindly suggesting the OP redirect to /dev/null when it's clear that his command isn't even being run. Fix errors first, then clean up output –  Daniel Lawson Jan 12 '11 at 17:37
1  
You're giving me -1 for answering his actual question? Vicious, man. –  blueben Jan 12 '11 at 18:33

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.