entrypoint.sh 621 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/bin/bash
  2. set -e
  3. if [ "${1:0:1}" = '-' ]; then
  4. set -- memcached "$@"
  5. fi
  6. dever_memcache()
  7. {
  8. e=${1}" -u root -d -p "${2}" "${3}
  9. eval $e
  10. echo $e
  11. echo 'Memcached init process complete; ready for start up.'
  12. }
  13. dever_start()
  14. {
  15. if [ -n "$MEMCACHED_PORT" ] ; then
  16. ifs="-"
  17. if [[ $MEMCACHED_PORT =~ $ifs ]] ; then
  18. port=(${MEMCACHED_PORT//-/ })
  19. for i in ${port[@]} ;
  20. do
  21. dever_memcache $1 $i $3
  22. done
  23. else
  24. dever_memcache $1 $MEMCACHED_PORT $3
  25. fi
  26. else
  27. dever_memcache $1 $2 $3
  28. fi
  29. }
  30. if [ "$1" = 'memcached' ]; then
  31. d=11211
  32. c=$MEMCACHED_COMMAND
  33. m="memcached"
  34. dever_start $m $d $c
  35. fi
  36. exec sh