You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by so...@apache.org on 2007/12/12 22:30:42 UTC

svn commit: r603748 - /lenya/branches/revolution/1.3.x/lenya.sh

Author: solprovider
Date: Wed Dec 12 13:30:42 2007
New Revision: 603748

URL: http://svn.apache.org/viewvc?rev=603748&view=rev
Log:
Replaced lenya.sh with revised version from Lenya 1.2 to add "stop" command line option and set LENYA_HOME properly.

Modified:
    lenya/branches/revolution/1.3.x/lenya.sh

Modified: lenya/branches/revolution/1.3.x/lenya.sh
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/lenya.sh?rev=603748&r1=603747&r2=603748&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/lenya.sh (original)
+++ lenya/branches/revolution/1.3.x/lenya.sh Wed Dec 12 13:30:42 2007
@@ -1,10 +1,11 @@
 #!/bin/sh
 
-# Copyright 1999-2004 The Apache Software Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
 #
 #     http://www.apache.org/licenses/LICENSE-2.0
 #
@@ -21,9 +22,10 @@
 # -----------------------------------------------------------------------------
 
 # Configuration variables
-#
+JETTY_PORT="8888"
+
 # LENYA_HOME
-#   The root of the Lenya distribution
+#   The root of the Lenya distribution automatically set to directory containing this file.
 #
 # LENYA_WEBAPP_HOME
 #   The root of the Lenya web application
@@ -60,6 +62,7 @@
     echo "  servlet-admin     Run Lenya in a servlet container and turn on container web administration"
     echo "  servlet-debug     Run Lenya in a servlet container and turn on JVM remote debug"
     echo "  servlet-profile   Run Lenya in a servlet container and turn on JVM profiling"
+    echo "  stop              Stop Lenya in a servlet container"
     exit 1
 }
 
@@ -87,9 +90,9 @@
   JAVA_OPTIONS='-Xms32M -Xmx512M'
 fi
 
-if [ "$LENYA_HOME" = "" ] ; then
-  LENYA_HOME='.'
-fi
+# Set Lenya home to directory containing this script
+cd `dirname $0`
+LENYA_HOME=`pwd -P`
 
 if [ "$LENYA_WEBAPP_HOME" = "" ] ; then
   STANDALONE_WEBAPP=../webapp
@@ -153,6 +156,22 @@
 JETTY_ADMIN_ARGS="-Djetty.admin.port=$JETTY_ADMIN_PORT"
 JETTY_LIBRARIES="-Dloader.jar.repositories=$LENYA_HOME/tools/jetty/lib${PATHSEP}${ENDORSED_LIBS}"
 
+# ---- Stop Lenya ------------------------------------------------------------- 
+    if [ -f $LENYA_HOME/lenya.pid ] ; then
+       echo -n $"Stopping $prog: "
+       kill -9 `cat lenya.pid`
+       rm -f $LENYA_HOME/lenya.pid
+       if [ "stop" = $ACTION ]; then  
+         exit 0
+       fi
+       sleep 10
+    else
+       if [ "stop" = $ACTION ]; then
+         echo "Cannot stop Lenya.  No lenya.pid."
+         exit 1
+       fi
+    fi
+
 # ----- Do the action ----------------------------------------------------------
 
 if [ -d build ]; then
@@ -176,22 +195,26 @@
 case "$ACTION" in
   cli)
         $JAVA $JAVA_OPTIONS -cp $LOADER_LIB $ENDORSED $CLI_LIBRARIES $CLI $LOADER $ARGS
-        ;;
+	;;
 
   servlet)
-        $JAVA $JAVA_OPTIONS -cp $LOADER_LIB $ENDORSED $PARSER $JETTY_PORT_ARGS $JETTY_LIBRARIES $JETTY_WEBAPP $JETTY_HOME $JETTY $LOADER $JETTY_MAIN
+        $JAVA $JAVA_OPTIONS -cp $LOADER_LIB $ENDORSED $PARSER $JETTY_PORT_ARGS $JETTY_LIBRARIES $JETTY_WEBAPP $JETTY_HOME $JETTY $LOADER $JETTY_MAIN &
+        echo $! >lenya.pid
         ;;
 
   servlet-admin)
-        $JAVA $JAVA_OPTIONS -cp $LOADER_LIB $ENDORSED $PARSER $JETTY_PORT_ARGS $JETTY_ADMIN_ARGS $JETTY_LIBRARIES $JETTY_WEBAPP $JETTY_HOME $JETTY $LOADER $JETTY_MAIN $JETTY_ADMIN
+        $JAVA $JAVA_OPTIONS -cp $LOADER_LIB $ENDORSED $PARSER $JETTY_PORT_ARGS $JETTY_ADMIN_ARGS $JETTY_LIBRARIES $JETTY_WEBAPP $JETTY_HOME $JETTY $LOADER $JETTY_MAIN $JETTY_ADMIN &
+        echo $! >lenya.pid
         ;;
 
   servlet-debug)
-        $JAVA $JAVA_OPTIONS $JAVA_DEBUG_ARGS -cp $LOADER_LIB $ENDORSED $PARSER $JETTY_PORT_ARGS $JETTY_LIBRARIES $JETTY_WEBAPP $JETTY_HOME $JETTY $LOADER $JETTY_MAIN
+        $JAVA $JAVA_OPTIONS $JAVA_DEBUG_ARGS -cp $LOADER_LIB $ENDORSED $PARSER $JETTY_PORT_ARGS $JETTY_LIBRARIES $JETTY_WEBAPP $JETTY_HOME $JETTY $LOADER $JETTY_MAIN &
+        echo $! >lenya.pid
         ;;
 
   servlet-profile)
-        $JAVA $JAVA_OPTIONS $JAVA_PROFILE_ARGS -cp $LOADER_LIB $ENDORSED $PARSER $JETTY_ARGS $JETTY_LIBRARIES $JETTY_WEBAPP $JETTY_HOME $JETTY $LOADER $JETTY_MAIN
+        $JAVA $JAVA_OPTIONS $JAVA_PROFILE_ARGS -cp $LOADER_LIB $ENDORSED $PARSER $JETTY_ARGS $JETTY_LIBRARIES $JETTY_WEBAPP $JETTY_HOME $JETTY $LOADER $JETTY_MAIN &
+        echo $! >lenya.pid
         ;;
 
   *)



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org