clsync-start-cluster.sh 734 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/bin/sh
  2. echo "Is not implemented, yet!" >&2
  3. exit 1
  4. IFACE="$1"
  5. if [ "$IFACE" = "" ]; then
  6. echo "syntax: $0 <inet interface name>" >&2
  7. echo "example: $0 eth0" >&2
  8. exit 1
  9. fi
  10. IPADDR=$(ip a s "$IFACE" | awk '{if($1=="inet") {gsub("/.*", "", $2); print $2}}')
  11. if [ "$IPADDR" = "" ]; then
  12. echo "Interface \"$IFACE\" doesn't exists or there's no IP-addresses assigned to it." >&2
  13. exit 2
  14. fi
  15. mkdir -m 700 -p testdir/from testdir/to testdir/listdir
  16. cat > rules <<EOF
  17. -d^[Dd]ont[Ss]ync\$
  18. +*.*
  19. EOF
  20. case "$(uname -s)" in
  21. GNU/kFreeBSD)
  22. OPTS=''
  23. ;;
  24. *)
  25. OPTS='-p safe'
  26. ;;
  27. esac
  28. 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 $@