Guest User

Untitled

a guest
Jan 21st, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. ### BEGIN INIT INFO
  4. # Provides: tomcat
  5. # Required-Start: $local_fs $remote_fs $network $syslog
  6. # Required-Stop: $local_fs $remote_fs $network $syslog
  7. # Default-Start: 2 3 4 5
  8. # Default-Stop: 0 1 6
  9. # Short-Description: starts the tomcat web server
  10. # Description: starts tomcat using start-stop-daemon
  11. ### END INIT INFO
  12.  
  13. PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
  14. START_DAEMON=/opt/apache-tomcat-6.0.33/bin/startup.sh
  15. STOP_DAEMON=/opt/apache-tomcat-6.0.33/bin/shutdown.sh
  16.  
  17. NAME=tomcat
  18. DESC=tomcat
  19.  
  20. set -e
  21.  
  22. . /lib/lsb/init-functions
  23.  
  24. case "$1" in
  25. start)
  26. tomcat_pid=`ps -ef | grep apache | grep tomcat | grep java | egrep -v grep | awk '{print $2}'`
  27. if [ -n "$tomcat_pid" ]; then
  28. echo "Tomcat is running."
  29. exit 1;
  30. fi
  31. echo -n "Starting $DESC:\n $START_DAEMON \n"
  32. $START_DAEMON
  33. ;;
  34.  
  35. stop)
  36. tomcat_pid=`ps -ef | grep apache | grep tomcat | grep java | egrep -v grep | awk '{print $2}'`
  37. if [ -z "$tomcat_pid" ]; then
  38. echo "Tomcat is not running."
  39. exit 1;
  40. fi
  41. echo -n "Stopping $DESC:\n $STOP_DAEMON \n "
  42. $STOP_DAEMON
  43. ;;
  44.  
  45. restart|force-reload)
  46. tomcat_pid=`ps -ef | grep apache | grep tomcat | grep java | egrep -v grep | awk '{print $2}'`
  47. if [ -n "$tomcat_pid" ]; then
  48. echo -n "Restarting $DESC: \n $STOP_DAEMON \n"
  49. $STOP_DAEMON
  50. sleep 5
  51. fi
  52. echo -n "starting $DESC: \n $START_DAEMON \n"
  53. $START_DAEMON
  54. echo "Starting, please wait for about 50 seconds."
  55. sleep 20
  56. ;;
  57.  
  58. *)
  59. echo "Usage: $NAME {start|stop|restart}" >&2
  60. exit 1
  61. ;;
  62. esac
  63.  
  64. exit 0
Add Comment
Please, Sign In to add comment