run.sh 774 B

123456789101112131415161718192021222324252627282930313233
  1. #!/bin/sh
  2. echo "NODE_ENV: $NODE_ENV"
  3. echo "BASE_URL: $BASE_URL"
  4. echo "COMMON_URL: $COMMON_URL"
  5. updateHost(){
  6. in_ip = ${1}
  7. in_url = ${2}
  8. inner_host=`cat /etc/hosts | grep ${in_url} | awk '{print $1}'`
  9. if [ ${inner_host} = ${in_ip} ];then
  10. echo "${inner_host} ${in_url} ok"
  11. else
  12. if [ ${inner_host} != "" ];then
  13. echo " change is ok "
  14. else
  15. inner_ip_map="${in_ip} ${in_url}"
  16. echo ${inner_ip_map} >> /etc/hosts
  17. if [ $? = 0 ]; then
  18. echo "${inner_ip_map} to hosts success host is `cat /etc/hosts`"
  19. fi
  20. fi
  21. fi
  22. }
  23. if [ "$NODE_ENV" == 'production' ]; then
  24. # updateHost 10.10.0.150 api-order.usoftmall.com
  25. # updateHost 10.10.0.150 api-product.usoftmall.com
  26. npm run build
  27. npm run start
  28. else
  29. npm run dev-start
  30. fi