blob: c1b8995176165c20ac7fa4ae7a2bb334a66b78af [file] [log] [blame]
david_williamsf7153ba2010-08-16 20:19:32 +00001#!/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
47if [ -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
71fi
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
76mkdir -p $CCDIR/tmp/
david_williamsbc659d72011-03-08 07:20:13 +000077CC_OPTS="-Djava.io.tmpdir=$CCDIR/tmp/ -Xms128m -Xmx384m"
david_williamsf7153ba2010-08-16 20:19:32 +000078#CC_OPTS="-Xms256m -Xmx1024m"
79echo " starting cruisecontrol.sh"
80
81#--------------------------------------------
82# set JAVA_HOME on Mac OSX
83#--------------------------------------------
84case "`uname`" in
85 Darwin*)
86 if [ -z "$JAVA_HOME" ] ; then
87 JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home
88 fi
89 ;;
90esac
91
92LIBDIR=$CCDIR/lib
93LAUNCHER=$LIBDIR/cruisecontrol-launcher.jar
94if [ -z "$JETTY_LOGS" ] ; then
95 JETTY_LOGS=$CCDIR/logs
96fi
97
98# convert the existing path to unix
99if [ `uname | grep -n CYGWIN` ]; then
100 JAVA_HOME=`cygpath --path --unix "$JAVA_HOME"`
101fi
102
103# convert the existing path to unix
104if [ `uname | grep -n CYGWIN` ]; then
105 CRUISE_PATH=`cygpath --path --windows "$CRUISE_PATH"`
106fi
107
108if [ `uname | grep -n CYGWIN` ]; then
109 LAUNCHER=`cygpath --windows "$LAUNCHER"`
110fi
111
112#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"
113#echo $EXEC
114#$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 &
115
116mkdir -p $CCDIR/logs
117
118EXEC="$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 $@ "
119echo "Full command: '$EXEC'"
120$EXEC &
121
122echo $! > cc.pid
123echo " ending cruisecontrol.sh"
124