clsync-start-cluster.sh 554 B

123456789101112131415161718192021222324252627
  1. #!/bin/bash
  2. IFACE="$1"
  3. if [ "$IFACE" = "" ]; then
  4. echo "syntax: $0 <inet interface name>" >&2
  5. echo "example: $0 eth0" >&2
  6. exit 1
  7. fi
  8. IPADDR=$(ip a s "$IFACE" | awk '{if($1=="inet") {gsub("/.*", "", $2); print $2}}')
  9. if [ "$IPADDR" = "" ]; then
  10. echo "Interface \"$IFACE\" doesn't exists or there's no IP-addresses assigned to it." >&2
  11. exit 2
  12. fi
  13. mkdir -m 700 -p testdir/{from,to,listdir}
  14. cat > rules <<EOF
  15. -d^[Dd]ont[Ss]ync\$
  16. +*.*
  17. EOF
  18. clsync -c "$IPADDR" -R -d ./testdir/listdir -w 2 -p -t 5 ./testdir/from ./clsync-synchandler-rsync.sh rules