diff -up ./extra/unix/bin/jetty.sh.fix ./extra/unix/bin/jetty.sh --- ./extra/unix/bin/jetty.sh.fix 2009-01-06 16:01:00.000000000 -0500 +++ ./extra/unix/bin/jetty.sh 2009-01-06 16:03:55.000000000 -0500 @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/sh # # Startup script for jetty under *nix systems (it works under NT/cygwin too). # @@ -106,6 +106,13 @@ findDirectory() done } +################################################## +# Check if we have a tty +################################################## +have_tty=0 +if [ "`tty`" != "not a tty" ]; then + have_tty=1 +fi ################################################## # See if there's a user-specific configuration file @@ -323,7 +330,7 @@ then then JETTY_CONSOLE=/dev/console else - JETTY_CONSOLE=/dev/tty + JETTY_CONSOLE=/dev/null fi fi @@ -356,7 +363,7 @@ then [ -x $J ] || continue VERSION=`eval $J -version 2>&1` [ $? = 0 ] || continue - VERSION=`expr "$VERSION" : '.*"\(1.[0-9\.]*\)"'` + VERSION=`expr "$VERSION" : '.*"\(1.[0-9\._]*\)"'` [ "$VERSION" = "" ] && continue expr $VERSION \< 1.2 >/dev/null && continue echo $VERSION:$J @@ -466,15 +473,15 @@ RUN_CMD="$JAVA $JAVA_OPTIONS -cp $CLASSP ################################################## case "$ACTION" in start) - echo "Starting Jetty: " - if [ -f $JETTY_PID ] then echo "Already Running!!" exit 1 fi - echo "STARTED Jetty `date`" >> $JETTY_CONSOLE + if [ $have_tty -eq 1 ]; then + echo "STARTED Jetty `date`" >> $JETTY_CONSOLE + fi nohup sh -c "exec $RUN_CMD >>$JETTY_CONSOLE 2>&1" >/dev/null & echo $! > $JETTY_PID @@ -488,7 +495,9 @@ case "$ACTION" in sleep 2 kill -9 $PID 2>/dev/null rm -f $JETTY_PID - echo "STOPPED `date`" >>$JETTY_CONSOLE + if [ $have_tty -eq 1 ]; then + echo "STOPPED `date`" >>$JETTY_CONSOLE + fi ;; restart) @@ -533,9 +542,9 @@ case "$ACTION" in echo "RUN_CMD = $RUN_CMD" echo - if [ -f $JETTY_RUN/jetty.pid ] + if [ -s $JETTY_PID ] then - echo "Jetty running pid="`cat $JETTY_RUN/jetty.pid` + echo "Jetty running pid="`cat $JETTY_PID` exit 0 fi exit 1