Blame view

examples/clsync-synchandler-rsyncshell.sh 438 Bytes
redmine authored
1
#!/bin/sh -x
redmine authored
2

redmine authored
3 4
FROM="`pwd`"
TO="`pwd`/../to"
redmine authored
5 6 7 8 9 10

ACTION="$1"
LABEL="$2"
ARG0="$3"
ARG1="$4"

redmine authored
11
rsynclist() {
redmine authored
12
	LISTFILE="$1"
redmine authored
13
	EXCLISTFILE="$2"
redmine authored
14

redmine authored
15 16
	excludefrom=''
	if [ "$EXCLISTFILE" != "" ]; then
redmine authored
17
		excludefrom="--exclude-from=${EXCLISTFILE}"
redmine authored
18
	fi
redmine authored
19

redmine authored
20
	exec rsync -avH --delete-before "$excludefrom" --include-from="${LISTFILE}" --exclude='*' "$FROM"/ "$TO"/
redmine authored
21 22

	return 0
redmine authored
23 24
}

redmine authored
25
case "$ACTION" in
redmine authored
26
	rsynclist)
redmine authored
27
		rsynclist "$ARG0" "$ARG1"
redmine authored
28
		;;
redmine authored
29 30 31 32
esac

exit $?