nodemanager.erb 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. #!/bin/sh
  2. #
  3. ### BEGIN INIT INFO
  4. # Provides: nodemanager
  5. # Required-Start:
  6. # Required-Stop:
  7. # Default-Start: 2 3 4 5
  8. # Default-Stop: 0 1 6
  9. # Short-Description: WebLogic Nodemanager
  10. ### END INIT INFO
  11. # nodemgr Oracle Weblogic NodeManager service
  12. #
  13. # chkconfig: 345 99 15
  14. # description: Oracle Weblogic NodeManager service
  15. #
  16. ### BEGIN INIT INFO
  17. # Provides: nodemgr
  18. # Required-Start: $network $local_fs
  19. # Required-Stop:
  20. # Should-Start:
  21. # Should-Stop:
  22. # Default-Start: 3 4 5
  23. # Default-Stop: 0 1 2 6
  24. # Short-Description: Oracle Weblogic NodeManager service.
  25. # Description: Starts and stops Oracle Weblogic NodeManager.
  26. ### END INIT INFO
  27. # Source function library.
  28. if test -f /lib/lsb/init-functions; then
  29. . /lib/lsb/init-functions
  30. fi
  31. . /etc/init.d/functions
  32. # set NodeManager environment
  33. NodeManagerLockFile=<%= @nodeMgrLckFile %>
  34. exec=<%= @nodeMgrBinPath %>/startNodeManager.sh
  35. prog='nodemanager'
  36. user='<%= @user %>'
  37. <% if @jsseEnabled == true %>
  38. JSEE_OPTIONS="-Dweblogic.ssl.JSSEEnabled=true -Dweblogic.security.SSL.enableJSSE=true"
  39. <% else %>
  40. JSEE_OPTIONS="-Dweblogic.ssl.JSSEEnabled=false -Dweblogic.security.SSL.enableJSSE=false"
  41. <% end %>
  42. TRUST_OPTIONS='<%= @trust_env %>'
  43. is_nodemgr_running() {
  44. local nodemgr_cnt=`ps -ef | \
  45. grep -i 'java ' | \
  46. grep -i ' weblogic.NodeManager ' | \
  47. grep -v grep | \
  48. wc -l`
  49. echo $nodemgr_cnt
  50. }
  51. get_nodemgr_pid() {
  52. nodemgr_pid=0
  53. if [ `is_nodemgr_running` -eq 1 ]; then
  54. nodemgr_pid=`ps -ef | \
  55. grep -i 'java ' | \
  56. grep -i ' weblogic.NodeManager ' | \
  57. grep -v grep | \
  58. tr -s ' ' | \
  59. cut -d' ' -f2`
  60. fi
  61. echo $nodemgr_pid
  62. }
  63. check_nodemgr_status () {
  64. local retval=0
  65. local nodemgr_cnt=`is_nodemgr_running`
  66. if [ $nodemgr_cnt -eq 0 ]; then
  67. if [ -f $NodeManagerLockFile ]; then
  68. retval=2
  69. else
  70. retval=3
  71. fi
  72. elif [ $nodemgr_cnt -gt 1 ]; then
  73. retval=4
  74. else
  75. retval=0
  76. fi
  77. echo $retval
  78. }
  79. start() {
  80. ulimit -n 65535
  81. [ -x $exec ] || exit 5
  82. echo -n $"Starting $prog: "
  83. sleep 10
  84. su $user -c "export JAVA_OPTIONS='${JSEE_OPTIONS} ${TRUST_OPTIONS}';$exec &"
  85. retval=$?
  86. echo
  87. return $retval
  88. }
  89. stop() {
  90. echo -n $"Stopping $prog: "
  91. kill -s 9 `get_nodemgr_pid` &> /dev/null
  92. retval=$?
  93. echo
  94. [ $retval -eq 0 ] && rm -f $NodeManagerLockFile
  95. return $retval
  96. }
  97. restart() {
  98. stop
  99. start
  100. }
  101. reload() {
  102. restart
  103. }
  104. force_reload() {
  105. restart
  106. }
  107. rh_status() {
  108. local retval=`check_nodemgr_status`
  109. if [ $retval -eq 0 ]; then
  110. echo "$prog (pid:`get_nodemgr_pid`) is running..."
  111. elif [ $retval -eq 4 ]; then
  112. echo "Multiple instances of $prog are running..."
  113. else
  114. echo "$prog is stopped"
  115. fi
  116. return $retval
  117. }
  118. rh_status_q() {
  119. rh_status >/dev/null 2>&1
  120. }
  121. case "$1" in
  122. start)
  123. rh_status_q && exit 0
  124. $1
  125. ;;
  126. stop)
  127. rh_status_q || exit 0
  128. $1
  129. ;;
  130. restart)
  131. $1
  132. ;;
  133. reload)
  134. rh_status_q || exit 7
  135. $1
  136. ;;
  137. force-reload)
  138. force_reload
  139. ;;
  140. status)
  141. rh_status
  142. ;;
  143. condrestart|try-restart)
  144. rh_status_q || exit 0
  145. restart
  146. ;;
  147. *)
  148. echo -n "Usage: $0 {"
  149. echo -n "start|"
  150. echo -n "stop|"
  151. echo -n "status|"
  152. echo -n "restart|"
  153. echo -n "condrestart|"
  154. echo -n "try-restart|"
  155. echo -n "reload|"
  156. echo -n "force-reload"
  157. echo "}"
  158. exit 2
  159. esac
  160. exit $?