david_williams | 0f58441 | 2008-12-07 02:06:50 +0000 | [diff] [blame^] | 1 | #!/usr/bin/env bash |
| 2 | |
| 3 | ################################################################################ |
| 4 | # CruiseControl, a Continuous Integration Toolkit |
| 5 | # Copyright (c) 2001, ThoughtWorks, Inc. |
| 6 | # 200 E. Randolph, 25th Floor |
| 7 | # Chicago, IL 60601 USA |
| 8 | # All rights reserved. |
| 9 | # |
| 10 | # Redistribution and use in source and binary forms, with or without |
| 11 | # modification, are permitted provided that the following conditions |
| 12 | # are met: |
| 13 | # |
| 14 | # + Redistributions of source code must retain the above copyright |
| 15 | # notice, this list of conditions and the following disclaimer. |
| 16 | # |
| 17 | # + Redistributions in binary form must reproduce the above |
| 18 | # copyright notice, this list of conditions and the following |
| 19 | # disclaimer in the documentation and/or other materials provided |
| 20 | # with the distribution. |
| 21 | # |
| 22 | # + Neither the name of ThoughtWorks, Inc., CruiseControl, nor the |
| 23 | # names of its contributors may be used to endorse or promote |
| 24 | # products derived from this software without specific prior |
| 25 | # written permission. |
| 26 | # |
| 27 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 28 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 29 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 30 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR |
| 31 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 32 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 33 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 34 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
| 35 | # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
| 36 | # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 37 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 38 | ################################################################################ |
| 39 | |
| 40 | # CCDIR: The root of the CruiseControl directory. |
| 41 | # The key requirement is that this is the parent |
| 42 | # directory of CruiseControl's lib and dist directories. |
| 43 | |
| 44 | # in WTP we set and pass in CCDIR from cc.sh |
| 45 | echo Using Cruise Control at $CCDIR |
| 46 | |
| 47 | if [ -z "$CCDIR" ] ; then |
| 48 | # resolve links - $0 may be a softlink |
| 49 | PRG="$0" |
| 50 | |
| 51 | # need this for relative symlinks |
| 52 | while [ -h "$PRG" ] ; do |
| 53 | ls=`ls -ld "$PRG"` |
| 54 | link=`expr "$ls" : '.*-> \(.*\)$'` |
| 55 | if expr "$link" : '/.*' > /dev/null; then |
| 56 | PRG="$link" |
| 57 | else |
| 58 | PRG=`dirname "$PRG"`"/$link" |
| 59 | fi |
| 60 | done |
| 61 | |
| 62 | saveddir=`pwd` |
| 63 | |
| 64 | CCDIR=`dirname "$PRG"` |
| 65 | |
| 66 | # make it fully qualified |
| 67 | CCDIR=`cd "$CCDIR" && pwd` |
| 68 | |
| 69 | cd $saveddir |
| 70 | echo Using Cruise Control at $CCDIR |
| 71 | fi |
| 72 | |
| 73 | # Uncomment the following line if you have OutOfMemoryError errors |
| 74 | # CC_OPTS="-Xms128m -Xmx256m" |
| 75 | # Note that the tmp directory must exist before CC needs it |
| 76 | mkdir -p $CCDIR/tmp/ |
| 77 | CC_OPTS="-Djava.io.tmpdir=$CCDIR/tmp/ -Xms256m -Xmx1024m" |
| 78 | #CC_OPTS="-Xms256m -Xmx1024m" |
| 79 | echo " starting cruisecontrol.sh" |
| 80 | |
| 81 | #-------------------------------------------- |
| 82 | # set JAVA_HOME on Mac OSX |
| 83 | #-------------------------------------------- |
| 84 | case "`uname`" in |
| 85 | Darwin*) |
| 86 | if [ -z "$JAVA_HOME" ] ; then |
| 87 | JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home |
| 88 | fi |
| 89 | ;; |
| 90 | esac |
| 91 | |
| 92 | LIBDIR=$CCDIR/lib |
| 93 | LAUNCHER=$LIBDIR/cruisecontrol-launcher.jar |
| 94 | |
| 95 | # convert the existing path to unix |
| 96 | if [ `uname | grep -n CYGWIN` ]; then |
| 97 | JAVA_HOME=`cygpath --path --unix "$JAVA_HOME"` |
| 98 | fi |
| 99 | |
| 100 | # convert the existing path to unix |
| 101 | if [ `uname | grep -n CYGWIN` ]; then |
| 102 | CRUISE_PATH=`cygpath --path --windows "$CRUISE_PATH"` |
| 103 | fi |
| 104 | |
| 105 | if [ `uname | grep -n CYGWIN` ]; then |
| 106 | LAUNCHER=`cygpath --windows "$LAUNCHER"` |
| 107 | fi |
| 108 | |
| 109 | #EXEC="$JAVA_HOME/bin/java $CC_OPTS -Djavax.management.builder.initial=mx4j.server.MX4JMBeanServerBuilder -Dcc.library.dir=$LIBDIR -jar $LAUNCHER $@ -jmxport 8000 -webport 8080 -rmiport 1099" |
| 110 | #echo $EXEC |
| 111 | #$JAVA_HOME/bin/java $CC_OPTS -Djavax.management.builder.initial=mx4j.server.MX4JMBeanServerBuilder "-Dcc.library.dir=$LIBDIR" -jar "$LAUNCHER" $@ -jmxport 8000 -webport 8080 -rmiport 1099 & |
| 112 | |
| 113 | mkdir -P $CCDIR/logs |
| 114 | DASHBOARD_CONFIG=${CCDIR}/dashboard-config.xml |
| 115 | |
| 116 | EXEC="$JAVA_HOME/bin/java $CC_OPTS -Djetty.logs=$CCDIR/logs -Ddashboard.config=${DASHBOARD_CONFIG} -Djavax.management.builder.initial=mx4j.server.MX4JMBeanServerBuilder -Dcc.library.dir=$LIBDIR -jar $LAUNCHER $@ " |
| 117 | echo "Full command: '$EXEC'" |
| 118 | $EXEC & |
| 119 | |
| 120 | echo $! > cc.pid |
| 121 | echo " ending cruisecontrol.sh" |
| 122 | |