clsync-synchandler-rsync.sh 454 B

123456789101112131415161718192021222324252627282930313233
  1. #!/bin/bash -x
  2. FROM="./testdir/from"
  3. TO="./testdir/to"
  4. ACTION="$1"
  5. LABEL="$2"
  6. ARG0="$3"
  7. ARG1="$4"
  8. function rsynclist() {
  9. LISTFILE="$1"
  10. EXCLISTFILE="$2"
  11. excludefrom=''
  12. if [ "$EXCLISTFILE" != "" ]; then
  13. excludefrom="--exclude-from=${EXCLISTFILE}"
  14. fi
  15. rsync -avH --delete-before "$excludefrom" --include-from="${LISTFILE}" --exclude='*' "$FROM"/ "$TO"/
  16. return 0
  17. }
  18. case "$ACTION" in
  19. rsynclist)
  20. rsynclist "$ARG0" "$ARG1"
  21. ;;
  22. esac
  23. exit $?