Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The code below should redirect all output to /dev/null however root still receives an email with output from the first command (/usr/bin/svnadmin). Why?

# Dump repo and upload via tarsnap

/usr/bin/svnadmin dump /srv/repos/www | gzip > /srv/repos/backup/www-repo-`date --iso-8601`.gz > /dev/null 2>&1
/usr/local/bin/tarsnap -c -f www-repo-`date --iso-8601` /srv/repos/backup/www-repo-`date --iso-8601`.gz > /dev/null 2>&1
share|improve this question
up vote 2 down vote accepted

You have piped the second commands STDOUT and STDERR to /dev/null, and only piped the first command's STDOUT to the second command. So the first command's STDERR is e-mail-ed to you.

You should write

( /usr/bin/svnadmin dump /srv/repos/www | gzip > /srv/repos/backup/www-repo-`date --iso-8601`.gz ) > /dev/null 2>&1
share|improve this answer

With my reputation I can't add comments, so I'll have to submit an answer allthough I'm not sure this is the case.

What does your crontab look like? I don't think it's your script that sends the e-mail, cron/crontab is doing that. So please show us contents of your crontab (crontab -e).

I might be wrong (I actually used cron myself for the first time just yesterday), but I think you should have the > /dev/null 2>&1 part in your crontab rather than in your script file. So your crontab could look something like this:

@hourly /your/script/location > /dev/null 2>&1

Hope this helps.

share|improve this answer

Your Answer


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.