restart_wcm.sh 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/bin/sh
  2. #######################################################
  3. ##
  4. ##
  5. ## script for restart wcmapp.shutdown and then startup
  6. ##
  7. ##
  8. #######################################################
  9. #######################################################
  10. ##
  11. ## vars:
  12. ## SH_SHUTDOWN the shutdown shell script. e.g.:/home/TRS/TRSWCMV65/Tomcat/bin/shutdown.sh -force
  13. ## SH_STARTUP the startup shell script. e.g.:/home/TRS/TRSWCMV65/Tomcat/bin/startup.sh
  14. ## WCMAPP_PID the pid file of the app. e.g.:/home/TRS/TRSWCMV65/Tomcat/wcmv65_tomcat.pid
  15. ## PROGRAM the unique program line for pgrep checking process. e.g.:java
  16. ## WAIT_SECS the shutdown duration,in seconds.
  17. ##
  18. #######################################################
  19. ##SH_SHUTDWON="/home/wcmteam/WCMV7/Tomcat/bin/shutdown.sh -force"
  20. SH_SHUTDWON=
  21. ##SH_STARTUP=/home/wcmteam/WCMV7/Tomcat/bin/startup.sh
  22. SH_STARTUP=
  23. ##WCMAPP_PID=/home/wcmteam/WCMV7/Tomcat/wcmv7_tomcat.pid #caution:rm -f will be executed on this file without test what it is.
  24. WCMAPP_PID=
  25. PROGRAM=WCMV7
  26. WAIT_SECS=60
  27. echo 'shuting down wcmapp'
  28. $SH_SHUTDOWN
  29. #check via pgrep, use kill if not shutdown.TODO: use WCMAPP_PID may be better.
  30. sleep $WAIT_SECS
  31. pgrep -f "$PROGRAM"|xargs -l kill -9
  32. #remove pid file if exists
  33. [ -f "$WCMAPP_PID" ] && rm -f "$WCMAPP_PID"
  34. echo 'start wcmapp'
  35. $SH_STARTUP
  36. #TODO send notify email via sendmail?