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. my script

  • You probably want to add --verbose and look at the rsync output Nov 1 '13 at 13:35

Use the --stats argument to rsync and parse its output. e.g.:

transferred=$(rsync -ar --stats $src $dest | awk '/files transferred/ {print $5}')

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.