File: clsync-start-cluster.sh

package info (click to toggle)
clsync 0.4.5-2.2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,404 kB
  • sloc: ansic: 15,074; sh: 466; makefile: 269
file content (38 lines) | stat: -rwxr-xr-x 734 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/sh

echo "Is not implemented, yet!" >&2

exit 1
IFACE="$1"

if [ "$IFACE" = "" ]; then
	echo "syntax:  $0 <inet interface name>" >&2
	echo "example: $0 eth0" >&2
	exit 1
fi

IPADDR=$(ip a s "$IFACE" | awk '{if($1=="inet") {gsub("/.*", "", $2); print $2}}')

if [ "$IPADDR" = "" ]; then
	echo "Interface \"$IFACE\" doesn't exists or there's no IP-addresses assigned to it." >&2
	exit 2
fi

mkdir -m 700 -p testdir/from testdir/to testdir/listdir

cat > rules <<EOF
-d^[Dd]ont[Ss]ync\$
+*.*
EOF

case "$(uname -s)" in
	GNU/kFreeBSD)
		OPTS=''
		;;
	*)
		OPTS='-p safe'
		;;
esac

sudo "$(which clsync)" -K example-cluster -c "$IPADDR" -M rsyncshell -w 2 -t 5 -W ./testdir/from -S ./clsync-synchandler-rsync.sh -R rules $OPTS $@