I have a script to backup my images and alert me to the status of the script which gets run every 5 minutes. However, I want to figure out how to identify when rsync was successful, but didn't do anything (no files transferred) so I can not notify when that happens. So line 37 should only print if files were actually transferred.
1 Answer
Use the --stats argument to rsync and parse its output. e.g.:
transferred=$(rsync -ar --stats $src $dest | awk '/files transferred/ {print $5}')
--verbose
and look at the rsync output