entrypoint.sh 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #!/bin/sh
  2. case "$1" in
  3. 'master')
  4. ARGS="-mdir=/data -volumePreallocate -volumeSizeLimitMB=1024"
  5. exec /usr/bin/weed $@ $ARGS
  6. ;;
  7. 'volume')
  8. ARGS="-dir=/data -max=0"
  9. if [[ $@ == *"-max="* ]]; then
  10. ARGS="-dir=/data"
  11. fi
  12. exec /usr/bin/weed $@ $ARGS
  13. ;;
  14. 'server')
  15. ARGS="-dir=/data -volume.max=0 -master.volumePreallocate -master.volumeSizeLimitMB=1024"
  16. if [[ $@ == *"-volume.max="* ]]; then
  17. ARGS="-dir=/data -master.volumePreallocate -master.volumeSizeLimitMB=1024"
  18. fi
  19. exec /usr/bin/weed $@ $ARGS
  20. ;;
  21. 'filer')
  22. ARGS=""
  23. exec /usr/bin/weed $@ $ARGS
  24. ;;
  25. 's3')
  26. ARGS="-domainName=$S3_DOMAIN_NAME -key.file=$S3_KEY_FILE -cert.file=$S3_CERT_FILE"
  27. exec /usr/bin/weed $@ $ARGS
  28. ;;
  29. 'cronjob')
  30. MASTER=${WEED_MASTER-localhost:9333}
  31. FIX_REPLICATION_CRON_SCHEDULE=${CRON_SCHEDULE-*/7 * * * * *}
  32. echo "$FIX_REPLICATION_CRON_SCHEDULE" 'echo "volume.fix.replication" | weed shell -master='$MASTER > /crontab
  33. BALANCING_CRON_SCHEDULE=${CRON_SCHEDULE-25 * * * * *}
  34. echo "$BALANCING_CRON_SCHEDULE" 'echo "volume.balance -c ALL -force" | weed shell -master='$MASTER >> /crontab
  35. echo "Running Crontab:"
  36. cat /crontab
  37. exec supercronic /crontab
  38. ;;
  39. *)
  40. exec /usr/bin/weed $@
  41. ;;
  42. esac