source=$(cat "$__object/parameter/source")
remote_user=$(cat "$__object/parameter/remote-user")

if [ -f "$__object/parameter/destination" ]; then
    destination=$(cat "$__object/parameter/destination")
else
    destination="/$__object_id"
fi

set --
if [ -f "$__object/parameter/rsync-opts" ]; then
    while read opts; do
        set -- "$@" "$opts"
    done
fi

echo rsync -a \
    --no-owner --no-group \
    -q "$@" "${source}/" "${remote_user}@${__target_host}:${destination}"
