72crm.sh 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #!/bin/bash
  2. COMMAND="$1"
  3. if [[ "$COMMAND" != "start" ]] && [[ "$COMMAND" != "stop" ]] && [[ "$COMMAND" != "restart" ]]; then
  4. echo "Usage: $0 start | stop | restart"
  5. exit 0
  6. fi
  7. APP_BASE_PATH=$(cd `dirname $0`; pwd)
  8. function start()
  9. {
  10. JAVA_OPTS=-Dspring.profiles.include=core,test
  11. if [[ "${project.artifactId}" == "wk_gateway" ]]; then
  12. JAVA_OPTS=
  13. fi
  14. # -Xms分配堆最小内存,默认为物理内存的1/64;-Xmx分配最大内存,默认为物理内存的1/4 如果程序会崩溃请将此值调高
  15. nohup java -Xms128m -Xmx512m -jar ${JAVA_OPTS} ${project.artifactId}-${project.version}.jar >> /dev/null 2>&1 &
  16. echo "--------项目启动成功--------"
  17. echo "--------欢迎使用悟空CRM ^_^--------"
  18. }
  19. function stop()
  20. {
  21. P_ID=`ps -ef | grep -w ${project.artifactId}-${project.version}.jar | grep -v "grep" | awk '{print $2}'`
  22. kill $P_ID
  23. echo "项目已关闭"
  24. }
  25. function restart()
  26. {
  27. P_ID=`ps -ef | grep -w ${project.artifactId}-${project.version}.jar | grep -v "grep" | awk '{print $2}'`
  28. start
  29. sleep 25s
  30. kill $P_ID
  31. echo "项目重启成功"
  32. }
  33. if [[ "$COMMAND" == "start" ]]; then
  34. start
  35. elif [[ "$COMMAND" == "stop" ]]; then
  36. stop
  37. else
  38. restart
  39. fi