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.

58 lines
1.6 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="-ip `hostname -i` "
  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. CRON_SCHEDULE=${CRON_SCHEDULE-*/5 * * * * *}
  43. echo "$CRON_SCHEDULE" 'echo "volume.fix.replication" | weed shell -master='$MASTER > /crontab
  44. echo "Running Crontab:"
  45. cat /crontab
  46. exec supercronic /crontab
  47. ;;
  48. *)
  49. exec /usr/bin/weed $@
  50. ;;
  51. esac