Skip to content

Instantly share code, notes, and snippets.

@udienz
Created April 8, 2014 08:01
Show Gist options
  • Select an option

  • Save udienz/10100729 to your computer and use it in GitHub Desktop.

Select an option

Save udienz/10100729 to your computer and use it in GitHub Desktop.
Get Rsync Sedot Sampai Tua (tm)
#!/usr/bin/env bash
. `dirname $0`/../lib/init.sh
. $BASE/lib/common.sh
set -e
EXCLUDE=
INCLUDE=
if [ -f $PKGDIR/rsync.exclude ]; then
EXCLUDE="--exclude-from $PKGDIR/rsync.exclude"
fi
if [ -f $PKGDIR/rsync.include ]; then
INCLUDE="--include-from $PKGDIR/rsync.include"
fi
if [ $DRYRUN == "1" ]; then
DRYRUNOPT="--dry-run"
fi
echo 1 > $STEPFILE
set +e
set -x
rsync $SOURCE $TARGET $EXCLUDE $INCLUDE $RSYNCOPTS --ipv4
ERR=$?
# rsync's exit 23 is not really an error
if [ $ERR -eq 0 -o $ERR -eq 23 ]; then
exit 0
else
exit $ERR
fi
set +x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment