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.

Today I found out I have a 25GB /var/mail/root full of e-mails from rsync. Apparently it's sending myself (root@server) an e-mail with the file list every time I run an rsync, which happens to be once every few minutes.

This is a Debian server and I couldn't find any config files for rsync. So my questions are:

1- Where is the config file for rsync on Debian? 2- How do I disable those rsync e-mail notifications?

Thanks!

share|improve this question

5 Answers 5

up vote 7 down vote accepted

rsync does not send emails, so something else wrapped around rsync is doing it. I'm assuming this is a cronjob calling rsync. The cronjob that runs rsync generates output on stdout. By default, cron then mails that output to root.

So first, find the cronjob that is running rsync. Places to look:

/etc/crontab
/etc/cron.*/
run crontab -l as root
/var/spool/cron/*

Once you find the cronjob that calls rsync, try running it manually on the command line. You should find that it displays output that matches the emails you are receiving.

Next you need to redirect or suppress that output. In the cronjob, you can do something like this:

* * * * * /usr/bin/rsync blah &>/dev/null

to suppress all output. Alternately, change the rsync flags you are using to eliminate output, or redirect it to a logfile (but don't forget to then set up rotation!).

Another troubleshooting idea: include the headers from one of these emails in this question so we can examine them for clues.

share|improve this answer
2  
As an alternative to >/dev/null or >/some/logfile you can also use | logger -p facility.level -t sometag to feed the message to syslog for appropriate disposition... –  voretaq7 Jan 20 '11 at 21:43
    
Yeah that's an excellent point, although you would need to make sure you don't end up trying to stuff pages and pages of data through logger. –  Phil Hollenback Jan 20 '11 at 21:48

The solution for me was to add the -q (quiet) switch to my rsync command. Since I was running rsync under my user, this was convenient as I will still get emails if rsync fails for some reason.

share|improve this answer

My guess is that your rsync is being run by cron.

You will need to edit your crontab entry and redirect the output to /dev/null e.g.

10 * * * * rsync -av --delete source/ destination/ >/dev/null 2>&1
share|improve this answer

You need to add redirection from your script in cron to stop the email. Check your crontab (or the system crontab where the script runs) and add redirection like your_rsync_script.sh > /dev/null 2>&1.

You can also remove the "v" (verbosity) flag from the rsync command in order to quell the output from the cron job.

share|improve this answer

If you're running rsync out of cron, then rsync isn't sending you email, cron is. Cron will email the output of cronjobs to (by default) the root user. You can:

  • Run rsync without the verbose flag, in which case it will no longer generate a file list.
  • Redirect stdout/stderr of your cron job (using '>' i/o redirection)
share|improve this answer
    
As always, a quick and accurate answer here. Thank you very much, that's spot on! –  user67613 Jan 20 '11 at 21:22

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.