#!/bin/sh set -eox pipefail if [ "$RUN_ONCE" = "true" ]; then rsync -avz $SOURCE_DIR $TARGET_DIR else while inotifywait -r -e modify,create,delete,move $SOURCE_DIR; do rsync -avz $SOURCE_DIR $TARGET_DIR done fi