rsync via cron. How do I enable logging?

Posted by tetranz on Server Fault See other posts from Server Fault or by tetranz
Published on 2011-01-06T15:06:52Z Indexed on 2011/01/06 15:55 UTC
Read the original article Hit count: 164

Filed under:

Hi all

I'm backing up a remote server to another computer using rsync.

In cron.daily I have a file with this:

rsync -avz -e ssh [email protected]:/ /mybackup/

It uses a public / private key pair to login. This seems to work well most of the time however, I've (foolishly) only ever really checked it by looking at the dates on some important files (MySQL dumps) that I know change every day. Obviously, an error could occur after that file.

Sometimes it fails. When I run it manually, something like "client reset" sometimes happens.

What is the best way to log it so that I can check with certainty if it completed or not? The cron log doesn't indicate any errors. I haven't tried it but the rsync man page on the oldish version of CentOS on the backup machine doesn't show the --log-file option. I guess I could redirect stdout with > but I don't really want to know about every file. I just want to know if it all worked or not..

Thanks

© Server Fault or respective owner

Related posts about rsync