You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
1.8 KiB

  1. #!/bin/sh
  2. case "$1" in
  3. 'master')
  4. ARGS="-ip `hostname -i` -mdir /data"
  5. # Is this instance linked with an other master? (Docker commandline "--link master1:master")
  6. if [ -n "$MASTER_PORT_9333_TCP_ADDR" ] ; then
  7. ARGS="$ARGS -peers=$MASTER_PORT_9333_TCP_ADDR:$MASTER_PORT_9333_TCP_PORT"
  8. fi
  9. exec /usr/bin/weed $@ $ARGS
  10. ;;
  11. 'volume')
  12. ARGS="-ip `hostname -i` -dir /data"
  13. # Is this instance linked with a master? (Docker commandline "--link master1:master")
  14. if [ -n "$MASTER_PORT_9333_TCP_ADDR" ] ; then
  15. ARGS="$ARGS -mserver=$MASTER_PORT_9333_TCP_ADDR:$MASTER_PORT_9333_TCP_PORT"
  16. fi
  17. exec /usr/bin/weed $@ $ARGS
  18. ;;
  19. 'server')
  20. ARGS="-ip `hostname -i` -dir /data"
  21. if [ -n "$MASTER_PORT_9333_TCP_ADDR" ] ; then
  22. ARGS="$ARGS -master.peers=$MASTER_PORT_9333_TCP_ADDR:$MASTER_PORT_9333_TCP_PORT"
  23. fi
  24. exec /usr/bin/weed $@ $ARGS
  25. ;;
  26. 'filer')
  27. ARGS=""
  28. if [ -n "$MASTER_PORT_9333_TCP_ADDR" ] ; then
  29. ARGS="$ARGS -master=$MASTER_PORT_9333_TCP_ADDR:$MASTER_PORT_9333_TCP_PORT"
  30. fi
  31. exec /usr/bin/weed $@ $ARGS
  32. ;;
  33. 's3')
  34. ARGS="-domainName=$S3_DOMAIN_NAME -key.file=$S3_KEY_FILE -cert.file=$S3_CERT_FILE"
  35. if [ -n "$FILER_PORT_8888_TCP_ADDR" ] ; then
  36. ARGS="$ARGS -filer=$FILER_PORT_8888_TCP_ADDR:$FILER_PORT_8888_TCP_PORT"
  37. fi
  38. exec /usr/bin/weed $@ $ARGS
  39. ;;
  40. 'cronjob')
  41. MASTER=${WEED_MASTER-localhost:9333}
  42. FIX_REPLICATION_CRON_SCHEDULE=${CRON_SCHEDULE-*/7 * * * * *}
  43. echo "$FIX_REPLICATION_CRON_SCHEDULE" 'echo "volume.fix.replication" | weed shell -master='$MASTER > /crontab
  44. BALANCING_CRON_SCHEDULE=${CRON_SCHEDULE-25 * * * * *}
  45. echo "$BALANCING_CRON_SCHEDULE" 'echo "volume.balance -c ALL -f" | weed shell -master='$MASTER >> /crontab
  46. echo "Running Crontab:"
  47. cat /crontab
  48. exec supercronic /crontab
  49. ;;
  50. *)
  51. exec /usr/bin/weed $@
  52. ;;
  53. esac