run.sh 743 B

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