Author: manolo
Date: Tue Jan  5 09:49:14 2010
New Revision: 895966

URL: http://svn.apache.org/viewvc?rev=895966&view=rev
Log:

Fixed an issue building the run.sh script in windows.
Simplified build.xml in order to maintain the unix start script as an 
idependent file.
The run.sh script compose the classpath and is not needed to do it at build 
time.
run.sh puts pid and console files in the standard unix location if it is 
available.
now run.sh handles soft links, so it is possible to create links in /etc/rcX.d 
pointing to start and stop james.

Added:
    
james/server/sandbox/active/pure_spring_deployment/spring-deployment/src/main/bin/
    
james/server/sandbox/active/pure_spring_deployment/spring-deployment/src/main/bin/run.sh
Modified:
    
james/server/sandbox/active/pure_spring_deployment/spring-deployment/build.xml

Modified: 
james/server/sandbox/active/pure_spring_deployment/spring-deployment/build.xml
URL: 
http://svn.apache.org/viewvc/james/server/sandbox/active/pure_spring_deployment/spring-deployment/build.xml?rev=895966&r1=895965&r2=895966&view=diff
==============================================================================
--- 
james/server/sandbox/active/pure_spring_deployment/spring-deployment/build.xml 
(original)
+++ 
james/server/sandbox/active/pure_spring_deployment/spring-deployment/build.xml 
Tue Jan  5 09:49:14 2010
@@ -308,87 +308,9 @@
 
         <mkdir dir="${spring-deployment.target.bin.dir}" />
 
-        <!-- create unix startup script-->
-        <echo file="${spring-deployment.target.bin.dir}/run.sh" 
append="false"><![CDATA[#! /bin/sh
-################################################################
-# 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                 #
-#                                                              #
-# Unless required by applicable law or agreed to in writing,   #
-# software distributed under the License is distributed on an  #
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       #
-# KIND, either express or implied.  See the License for the    #
-# specific language governing permissions and limitations      #
-# under the License.                                           #
-################################################################
-
-# Uncomment to get enable remote debugging
-# DEBUG="-Xdebug 
-Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y"   
-JAMES_CONSOLE=james.console
-JAMES_PID=james.pid
-JAMES_CMD="java $DEBUG -cp ${exe-classpath}:../conf 
org.apache.james.container.spring.Main"             
-            
-case $1 in
- start)
-  echo 'Booting James'
-  if [ -f $JAMES_PID ]
-  then
-    if ps -p `cat $JAMES_PID ` >/dev/null 2>/dev/null
-      then
-        echo "Already Running!!"
-        exit 1
-    fi
-  fi
-   
-  echo "START `date`" >> $JAMES_CONSOLE
-  nohup sh -c "exec $JAMES_CMD >>$JAMES_CONSOLE 2>&1" >/dev/null &
-  echo $! > $JAMES_PID
-  echo "James pid="`cat $JAMES_PID`
-  @@SEMI_COLON@@@@SEMI_COLON@@
-  
- restart)
-  $0 stop $*
-  sleep 5
-  $0 start $*
-  @@SEMI_COLON@@@@SEMI_COLON@@
-
- stop)
-  PID=`cat $JAMES_PID 2>/dev/null`
-  echo "Shutting down James: $PID"
-  kill $PID 2>/dev/null
-  sleep 5
-  kill -9 $PID 2>/dev/null
-  rm -f $JAMES_PID
-  echo "STOPPED `date`" >>$JAMES_CONSOLE
-  @@SEMI_COLON@@@@SEMI_COLON@@
-
- *)
-  echo 'Booting James'
-  if [ -f $JAMES_PID ]
-  then
-    echo "James is already running"
-      exit 1
-  fi
-  exec $JAMES_CMD
-  @@SEMI_COLON@@@@SEMI_COLON@@
-
-esac   
-]]></echo>
-        <replace file="${spring-deployment.target.bin.dir}/run.sh" 
token="${spring-deployment.target.lib.dir}" value="../lib" />
-
-       <replace file="${spring-deployment.target.bin.dir}/run.sh" token=";" 
value=":" />
-        <replace file="${spring-deployment.target.bin.dir}/run.sh" 
token="@@SEMI_COLON@@" value=';'/>  
-
+        <copy todir="${spring-deployment.target.bin.dir}" 
file="${basedir}/src/main/bin/run.sh" />
        <chmod file="${spring-deployment.target.bin.dir}/run.sh" perm="a+rx" />
 
-
         <!-- create windows startup script-->
                <pathconvert 
property="spring-deployment.target.lib.dir.windows" targetos="windows">
                  <path><pathelement 
location="${spring-deployment.target.lib.dir}" /></path>

Added: 
james/server/sandbox/active/pure_spring_deployment/spring-deployment/src/main/bin/run.sh
URL: 
http://svn.apache.org/viewvc/james/server/sandbox/active/pure_spring_deployment/spring-deployment/src/main/bin/run.sh?rev=895966&view=auto
==============================================================================
--- 
james/server/sandbox/active/pure_spring_deployment/spring-deployment/src/main/bin/run.sh
 (added)
+++ 
james/server/sandbox/active/pure_spring_deployment/spring-deployment/src/main/bin/run.sh
 Tue Jan  5 09:49:14 2010
@@ -0,0 +1,91 @@
+#! /bin/sh
+################################################################
+# 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                 #
+#                                                              #
+# Unless required by applicable law or agreed to in writing,   #
+# software distributed under the License is distributed on an  #
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       #
+# KIND, either express or implied.  See the License for the    #
+# specific language governing permissions and limitations      #
+# under the License.                                           #
+################################################################
+
+# Uncomment to get enable remote debugging
+# DEBUG="-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y"
+
+# put pid an log files in the standard unix folders, or in the current 
directory if we have not access
+[ -w /var/log/ ] && JAMES_CONSOLE=/var/log/james.console || 
JAMES_CONSOLE=james.console
+[ -w /var/run/ ] && JAMES_PID=/var/run/james.pid || JAMES_PID=james.pid
+
+# Resolve soft links
+PRG="$0"
+while [ -h "$PRG" ] ; do
+  ls=`ls -ld "$PRG"`
+  link=`expr "$ls" : '.*-> \(.*\)$'`
+  if expr "$link" : '/.*' > /dev/null; then
+    PRG="$link"
+  else
+    PRG=`dirname "$PRG"`/"$link"
+  fi
+done
+BIN=`dirname "$PRG"`
+
+# right now james needs to start working in the bin folder
+cd $BIN
+BIN=`pwd`
+JAMES_HOME=`dirname "$BIN"`
+[ ! -d "$JAMES_HOME/conf" -o ! -d "$JAMES_HOME/lib" ] && echo "Unable to 
locate JAMES_HOME" && exit 1
+
+start_james() {
+  echo 'Booting James'
+
+  # Compose classpath joining conf and all jars in lib.
+  JAMES_CP="$JAMES_HOME/conf:"`echo $JAMES_HOME/lib/*.jar | tr ' ' ':'`
+
+  if [ -f $JAMES_PID ]
+  then
+    if ps -p `cat $JAMES_PID ` >/dev/null 2>/dev/null
+      then
+        echo "Already Running!!"
+        exit 1
+    fi
+  fi
+   
+  JAMES_CMD="java $DEBUG -cp '$JAMES_CP' 
org.apache.james.container.spring.Main"             
+  echo "START `date`" >> $JAMES_CONSOLE
+  nohup sh -c "exec $JAMES_CMD >>$JAMES_CONSOLE 2>&1" >/dev/null &
+  echo $! > $JAMES_PID
+  echo "James pid="`cat $JAMES_PID`
+}
+
+stop_james() {
+  PID=`cat $JAMES_PID 2>/dev/null`
+  echo "Shutting down James: $PID"
+  kill $PID 2>/dev/null || return
+  sleep 5
+  kill -9 $PID 2>/dev/null
+  rm -f $JAMES_PID
+  echo "STOPPED `date`" >>$JAMES_CONSOLE
+}
+            
+case $1 in
+ restart)
+    stop_james
+    sleep 5
+    start_james
+    ;;
+ stop)  
+    stop_james
+    ;;
+ *)
+    start_james
+    ;;
+esac   



---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org
For additional commands, e-mail: server-dev-h...@james.apache.org

Reply via email to