如何防止通过电子邮件发送cron输出

I'm using a cron that gets accesses a URL to run a scheduled process. I keep getting successful emails... is there a way for me to only get emails if the wget request fails?

wget http://www.domain.com/cron/dailyEmail 2>&1;

wget --quiet http://www.domain.com/cron/dailyEmail || echo "wget failed"

(Note that an empty response is not a failure.)

If you're running wget directly in the cron setup, then no. You can't conditionally redirect output. You could, however, put the wget command into a shell script, and do the conditionals there.

#!/bin/sh

OUTPUT=`wget .... 2>1`
if [ $? != 0 ]
   echo $OUTPUT
fi