Mercurial > hg > digilib-old
annotate config/tomcat/bin/rctomcat @ 406:20cf1c19e8eb
construct marks with a div that has a transparent png as background image
| author | hertzhaft |
|---|---|
| date | Tue, 13 Dec 2005 13:26:30 +0100 |
| parents | b72385d8d859 |
| children |
| rev | line source |
|---|---|
| 25 | 1 #! /bin/sh |
| 2 # | |
| 3 | |
| 4 . /etc/rc.config | |
| 5 | |
| 6 # Determine the base and follow a runlevel link name. | |
| 7 base=${0##*/} | |
| 8 link=${base#*[SK][0-9][0-9]} | |
| 9 | |
| 10 # Force execution if not called by a runlevel directory. | |
| 11 #test $link = $base && START_XNTPD=yes | |
| 12 #test "$START_XNTPD" = yes || exit 0 | |
| 13 | |
| 14 # | |
| 15 # docuservers tomcat (ROC 2.11.01) | |
| 16 # | |
| 17 TOMCATLOG=/usr/local/httpd/logs/tomcat-err.log | |
| 18 TOMCATDIR=/opt/tomcat | |
| 19 | |
|
29
b72385d8d859
Changed from using "ps|grep" to "pgrep" (ps behaves differently under SuSE 7.x)
robcast
parents:
25
diff
changeset
|
20 TOMCAT_PID=""; |
|
b72385d8d859
Changed from using "ps|grep" to "pgrep" (ps behaves differently under SuSE 7.x)
robcast
parents:
25
diff
changeset
|
21 |
|
b72385d8d859
Changed from using "ps|grep" to "pgrep" (ps behaves differently under SuSE 7.x)
robcast
parents:
25
diff
changeset
|
22 function tomcat_runs() { |
|
b72385d8d859
Changed from using "ps|grep" to "pgrep" (ps behaves differently under SuSE 7.x)
robcast
parents:
25
diff
changeset
|
23 # we're looking at java vms executing org.apache.catalina.startup.Bootstrap |
|
b72385d8d859
Changed from using "ps|grep" to "pgrep" (ps behaves differently under SuSE 7.x)
robcast
parents:
25
diff
changeset
|
24 #ALL_TOMS=$( ps xa | grep org.apache.catalina.startup | grep -v grep ) |
|
b72385d8d859
Changed from using "ps|grep" to "pgrep" (ps behaves differently under SuSE 7.x)
robcast
parents:
25
diff
changeset
|
25 #ALL_TOM_IDS=$( echo $ALL_TOMS | cut -d " " -f 1 ) |
|
b72385d8d859
Changed from using "ps|grep" to "pgrep" (ps behaves differently under SuSE 7.x)
robcast
parents:
25
diff
changeset
|
26 ALL_TOMS=$( pgrep -u wwwrun java ) |
|
b72385d8d859
Changed from using "ps|grep" to "pgrep" (ps behaves differently under SuSE 7.x)
robcast
parents:
25
diff
changeset
|
27 TOMCAT_PID=$( echo $ALL_TOMS | head -1 ) |
|
b72385d8d859
Changed from using "ps|grep" to "pgrep" (ps behaves differently under SuSE 7.x)
robcast
parents:
25
diff
changeset
|
28 test -n "$TOMCAT_PID" |
|
b72385d8d859
Changed from using "ps|grep" to "pgrep" (ps behaves differently under SuSE 7.x)
robcast
parents:
25
diff
changeset
|
29 } |
|
b72385d8d859
Changed from using "ps|grep" to "pgrep" (ps behaves differently under SuSE 7.x)
robcast
parents:
25
diff
changeset
|
30 |
| 25 | 31 return="$rc_done" |
| 32 | |
| 33 case "$1" in | |
| 34 start) | |
| 35 echo -n "Starting Tomcat Servlet server " | |
| 36 su - wwwrun -c "$TOMCATDIR/bin/startup.sh" >> $TOMCATLOG 2>&1 || return=$rc_failed | |
| 37 echo -e "$return" | |
| 38 ;; | |
| 39 stop) | |
| 40 echo -n "Stopping Tomcat Servlet server " | |
| 41 if su - wwwrun -c "$TOMCATDIR/bin/shutdown.sh" >> $TOMCATLOG 2>&1 | |
| 42 then | |
| 43 for i in 1 2 3 4 5 | |
| 44 do | |
| 45 if tomcat_runs | |
| 46 then | |
| 47 return=$rc_failed | |
| 48 echo -n "." | |
| 49 sleep 2 | |
| 50 else | |
| 51 return=$rc_done | |
| 52 break | |
| 53 fi | |
| 54 done | |
| 55 if tomcat_runs | |
| 56 then | |
| 57 echo -n " killing." | |
| 58 kill $TOMCAT_PID | |
| 59 sleep 2 | |
| 60 fi | |
| 61 if tomcat_runs | |
| 62 then | |
| 63 return=$rc_failed | |
| 64 else | |
| 65 return=$rc_done | |
| 66 fi | |
| 67 else | |
| 68 return=$rc_failed | |
| 69 fi | |
| 70 | |
| 71 echo -e "$return" | |
| 72 ;; | |
| 73 reload|restart) | |
| 74 $0 stop && $0 start || return=$rc_failed | |
| 75 ;; | |
| 76 status) | |
| 77 echo -n "Checking for service tomcat: " | |
| 78 tomcat_runs && echo OK || echo No process | |
| 79 ;; | |
| 80 *) | |
| 81 echo "Usage: $0 {start|stop|status|reload|restart}" | |
| 82 exit 1 | |
| 83 esac | |
| 84 | |
| 85 # Inform the caller not only verbosely and set an exit status. | |
| 86 test "$return" = "$rc_done" || exit 1 | |
| 87 exit 0 |
