I am scheduling the following shell script #!/bin/bash(echo open mailserver.nowhere.local 25; sleep 1; echo EHLO; echo quit)\  | telnet | grep ?Invalid command    if [ $? -eq 1 ]; then       if [ -r /tmp/sendmail_stopped ]; then          rm /tmp/sendmail_stopped          /etc/init.d/sendmail start          mail -s sendmail has started back up. me@nowhere.com < /dev/null       else           echo sendmail OK       fi    else        if [ ! -r /tmp/sendmail_stopped ]; then            touch /tmp/sendmail_stopped            /etc/init.d/sendmail stop        else            echo sendmail still not OK        fi    filike this*/5 * * * * root /home/amr/bin/sendmail_alive.sh 2>&1 > /tmp/sendmail_alive.logbut am still getting email from the telnet command. I've tried a bunch of ways to suppress getting the email that contains the output of the telnet command, which isConnection closed by foreign host.I cannot figure out what I am doing wrong. Any suggestions would be appreciated.
How do I suppress all email notification from cron for particular job?
shell;cron;io redirection
Common mistake, wrong order of redirection, try this:  sendmail_alive.sh >/tmp/sendmail_alive.log 2>&1It works like this:file descriptor stdout to /tmp/sendmail_alive.logfile descriptor stderr to the value of stdout (/tmp/sendmail_alive.log)With your order, you first point the stderr where originally was stdout and you get the stderr message Connection closed by foreign host. there as a result.