title: Check if rsync command ran successful
body: <p>The following bash-script is doing a rsync of a folder every hour:</p>
  
  <pre><code>#!/bin/bash
  rsync -r -z -c /home/pi/queue root@server.mine.com:/home/foobar
  rm -rf rm /home/pi/queue/*
  echo "Done"
  </code></pre>
  
  <p>But I found out that my Pi disconnected from the internet, so the rsync failed. So it did the following command, deleting the folder.
  How to determine if a rsync-command was successful, if it was, then it may remove the folder.</p>