appd 846 B

12345678910111213141516171819202122232425262728293031323334
  1. #!/bin/bash
  2. # chkconfig: 2345 70 80
  3. # description: app script ....
  4. # this script move to /etc/init.d
  5. # must set variable script_home/script_username/script_memory
  6. script_home=/home/tomcat/eureka
  7. script_memory=512M
  8. script_username=tomcat
  9. # 信号编号SIGTERM,程序会清理线程现场,完成之后再结束程序
  10. # 如果程序还有事务在处理,是不会马上结束程序的,会执行Runtime.getRuntime().addShutdownHook(*)
  11. script=$script_home/app.sh
  12. # See how we were called.
  13. case "$1" in
  14. start)
  15. su $script_username -l -c "sh $script -h $script_home -m $script_memory -c $1"
  16. ;;
  17. stop)
  18. su $script_username -l -c "sh $script -h $script_home -c $1"
  19. ;;
  20. restart|reload)
  21. stop
  22. start
  23. ;;
  24. *)
  25. echo $"Usage: $0 {start|stop|restart|reload}"
  26. exit 1
  27. esac
  28. exit