I have a CentOS 5.5 x64 server that mirrors a NetGear ReadyNAS Everynight at midnight using rsync. I need a way to be alerted if the backups fail.
I have this in my users cron. It does run and works fine.
0 0 * * * /usr/bin/grsync-batch -f /home/user/jobname.grsync 2>&1 > /home/user/logfile
I do not run rsync as a daemon, so I do not think I can specify a syslog. I have a managed systems server that can watch for SNMP alerts and syslogs events if I know what error to tell it to look for. I monitor my mail server by checking if postfix and amavis are running and accepting connections and if not I run 'logger -p mail.info 'whatever error here' and then the Monitor server checks the log every hour and if that is in there, it alerts everyone. It would be OK if I could do something like that in a script.
How does everyone else alert themselves when rsync encounters an error?
Thanks,
Create a shell script to be called by cron. Within that shell script, place the grsync-batch command (along with options)....
$? is the exit code of the last command. 0 usually means success and anything else means an error occured.
rsync man page (exit values at the bottom)