Shell scripts control jar startup and stop

Source: Internet
Author: User
  1. #! /Bin/sh
  2. # Startup Method
  3. Start (){
  4. Java-xms128m-xmx2048m-jar test1.jar5> Log. log &
  5. Java-xms128m-xmx2048m-jar test2.jar5> Log. log &
  6. Tail-F result. Log
  7. }
  8. # Stop Method
  9. Stop (){
  10. PS-Ef | grep test | awk'{Print $2 }'|WhileRead PID
  11. Do
  12. Kill-9$ PID
  13. Done
  14. }
  15. Case "$1"In
  16. Start)
  17. Start
  18. ;;
  19. Stop)
  20. Stop
  21. ;;
  22. Restart)
  23. Stop
  24. Start
  25. ;;
  26. *)
  27. Printf'Usage: % s {START | stop | restart} \ N' "$ Prog"
  28. Exit1
  29. ;;
  30. Esac
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.