File jetty5-jettysh.patch of Package jetty5.openSUSE_12.1_Update

Index: jetty-5.1.14/extra/unix/bin/jetty.sh
===================================================================
--- jetty-5.1.14.orig/extra/unix/bin/jetty.sh	2003-09-16 06:03:33.000000000 +0200
+++ jetty-5.1.14/extra/unix/bin/jetty.sh	2009-06-17 09:45:34.424490579 +0200
@@ -4,7 +4,7 @@
 #
 # Configuration files
 #
-# $HOME/.jettyrc
+# /etc/jetty5/jettyrc
 #   This is read at the start of script. It may perform any sequence of
 #   shell commands, like setting relevant environment variables.
 #
@@ -81,7 +81,7 @@
 
 [ $# -gt 0 ] || usage
 
-TMPJ=/tmp/j$$
+TMPJ=`mktemp /tmp/jetty_stop.XXXXXX`
 
 ##################################################
 # Get the action & configs
@@ -110,8 +110,8 @@
 ##################################################
 # See if there's a user-specific configuration file
 ##################################################
-if [ -f $HOME/.jettyrc ] ; then 
-  . $HOME/.jettyrc
+if [ -z "$JETTYRC" ]; then
+  . /etc/jetty5/jettyrc
 fi
 
 
@@ -303,7 +303,7 @@
 #####################################################
 if [  -z "$JETTY_RUN" ] 
 then
-  JETTY_RUN=`findDirectory -w /var/run /usr/var/run /tmp`
+  JETTY_RUN=/var/run
 fi
 
 #####################################################
@@ -311,7 +311,7 @@
 #####################################################
 if [  -z "$JETTY_PID" ] 
 then
-  JETTY_PID="$JETTY_RUN/jetty.pid"
+  JETTY_PID="$JETTY_RUN/jetty5.pid"
 fi
 
 #####################################################
@@ -464,11 +464,20 @@
 ##################################################
 # Do the action
 ##################################################
+
+# suppress the output
+if [ -n "$QUIET" ]; then
+    exec 1> /dev/null
+    exec 2> /dev/null
+fi
 case "$ACTION" in
   start)
         echo "Starting Jetty: "
-
-        if [ -f $JETTY_PID ]
+        
+        if [ -f $JETTY_PID ]; then
+            read kpid < $JETTY_PID
+        fi
+        if [ -n "$kpid" ]
         then
             echo "Already Running!!"
             exit 1
@@ -482,12 +491,14 @@
         ;;
 
   stop)
-        PID=`cat $JETTY_PID 2>/dev/null`
+        if [ -f $JETTY_PID ]; then
+            read PID < $JETTY_PID
+        fi
         echo "Shutting down Jetty: $PID"
         kill $PID 2>/dev/null
         sleep 2
         kill -9 $PID 2>/dev/null
-        rm -f $JETTY_PID
+        echo > $JETTY_PID
         echo "STOPPED `date`" >>$JETTY_CONSOLE
         ;;
 
@@ -508,7 +519,10 @@
   run|demo)
         echo "Running Jetty: "
 
-        if [ -f $JETTY_PID ]
+        if [ -f $JETTY_PID ]; then
+            read kpid < $JETTY_PID
+        fi
+        if [ -n "$kpid" ]
         then
             echo "Already Running!!"
             exit 1
@@ -533,9 +547,12 @@
         echo "RUN_CMD        =  $RUN_CMD"
         echo
         
-        if [ -f $JETTY_RUN/jetty.pid ]
+        if [ -f $JETTY_PID ]; then
+            read kpid < $JETTY_PID
+        fi
+        if [ -n "$kpid" ]
         then
-            echo "Jetty running pid="`cat $JETTY_RUN/jetty.pid`
+            echo "Jetty running pid=$kpid"
             exit 0
         fi
         exit 1
openSUSE Build Service is sponsored by