Configuring CruiseControl for Linux
A while back I posted a movie on installing and configuring CruiseControl on Windows, so I figured I’d give a brief overview in Linux. I am using Ubuntu so some of the examples may be different for you — depending on the UNIX/Linux flavor you’re using. This assumes that Java is in your system’s path. To verify, type:
echo $JAVA_HOME -or-
echo $PATH
Step 1
Download CruiseControl to a temporary location.
Step 2
Extract it to the location you wish to install it. For example:
unzip cruisecontrol.zip /opt
Step 3
Create a user and group and ensure that CruiseControl files are owned by this group. For instance, as root, create a cimasters group and a cimaster user:
/usr/sbin/useradd -G cimasters cimaster
If /usr/sbin/ has been added to your path, you only need to enter useradd.
Now, change the owner of all CruiseControl files like this:
chown cimaster:cimasters /opt/cruisecontrol-bin-2.6.1 -R
Step 4
Create a file to run CruiseControl as a service. This is based on the CruiseControl service code from the CruiseControl wiki.
#!/bin/sh
CC_USER=cimaster
CC_INSTALL_DIR=/opt/cruisecontrol-bin-2.6.1
CC_WORK_DIR=$CC_INSTALL_DIR
CC_LOGFILE_DIR=$CC_INSTALL_DIR
export JAVA_HOME=/opt/jdk1.5.0_11
PATH_ADDITIONS=
CC_WEBPORT=8484
CC_JMXPORT=8888
CC_RMIPORT=
NAME=cruisecontrol
DESC="CruiseControl - continuous integration build loop"
PATH=/opt/jdk1.5.0_11/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/bin:/bin
if [ -n "$PATH_ADDITIONS" ]; then
PATH=$PATH_ADDITIONS:$PATH
fi
export PATH
CC_DAEMON=$CC_INSTALL_DIR/cruisecontrol.sh
CC_CONFIG_FILE=$CC_INSTALL_DIR/config.xml
CC_LOG_FILE=$CC_LOGFILE_DIR/cruisecontrol.log
CC_COMMAND="cd $CC_WORK_DIR; $CC_DAEMON -configfile $CC_CONFIG_FILE -webport $CC_WEBPORT -jmxport $CC_JMXPORT"
if [ -f /etc/default/cruisecontrol ]; then
. /etc/default/cruisecontrol
fi
test -f $CC_DAEMON || (echo "The executable $CC_DAEMON does not exist!" && exit 0)
if [ `id -u` -ne 0 ]; then
echo "Not starting/stopping $DESC, you are not root."
exit 4
fi
PARPID=`ps -ea -o "pid ppid args" | grep -v grep | grep "${CC_DAEMON}" | sed -e 's/^ *//' -e 's/ .*//'`
if [ "${PARPID}" != "" ]
then
PID=`ps -ea -o "pid ppid args" | grep -v grep | grep java | grep "${PARPID}" | \
sed -e 's/^ *//' -e 's/ .*//'`
fi
case "$1" in
'start')
env >> cc.startup.env
su $CC_USER -c "/bin/sh -c \"$CC_COMMAND >> $CC_LOG_FILE 2>&1\"" & RETVAL=$?
echo "$NAME started with jmx on port ${CC_JMXPORT}"
;;
'stop')
if [ "${PID}" != "" ]; then
kill -9 ${PID} ${PARPID}
$0 status
RETVAL=$?
else
echo "$NAME is not running"
RETVAL=1
fi
;;
'status')
# echo PARPIDs $PARPID
# echo PIDs $PID
kill -0 $PID >/dev/null 2>&1
if [ "$?" = "0" ]; then
echo $NAME \(pids $PARPID $PID\) is running
RETVAL=0
else
echo "$NAME is stopped"
RETVAL=1
fi
;;
'restart')
$0 stop && $0 start
RETVAL=$?
;;
*)
echo "Usage: $0 { start | stop | status | restart }"
exit 1
;;
esac
#echo ending $0 $$....
exit 0
Name this file cruisecontrol and place it in the /etc/init.d directory. Then, type:
./cruisecontrol start
Open your browser to http://localhost:8484/ (or whichever port you chose).

That should do it. Let me know if you have any questions.

March 24th, 2007 at 8:41 pm
[…] Configuring CruiseControl for Linux- Paul shows just how easy it is, man. […]
April 2nd, 2007 at 12:43 pm
[…] Configuring CruiseControl for Linux- Paul Duvall shows how easy it is. […]
October 30th, 2007 at 7:18 am
This is great and I was able to get it working also with RHEL4. One small issue with init script was that the status did not find CC from process list. I modified PARPID line so that CC_DAEMON is CC_INSTAL_DIR and it can work again. I can also stop and restart the process.
December 29th, 2007 at 2:51 pm
Good howto, I had some problems when trying to start the script when it fails (for dumb configuration reasons), it still seems to have services bound to various ports… as in, when I try to restart the service again, it claims jrmp is already bound. I can’t figure out what pid has this so I can kill it, any ideas? Cheers
March 13th, 2008 at 1:19 am
I think in step 4
line -> PARPID=`ps -ea -o “pid ppid args” | grep -v grep | grep “${CC_DAEMON}” | sed -e
it should be “CC_INSTALL” instead of “CC_DAEMON”
June 15th, 2008 at 3:55 am
[root@ps4634 ~]# ./cruisecontrol start
-bash: ./cruisecontrol: No such file or directory
I get this error
As per discussed above , i have created a cruisecontrol file in init.d in /etc
also the cruise control unzip is in usr/local/lib/cruise/ also i created a new user with all rights to that folder, secondly i also added the sym link to rc.d
still unable tyo understand where , what is going wrong & how will i add projects to cruisecontrol as we did on windows cruise add [projectname]
please help as soon as possible
June 15th, 2008 at 5:27 am
[root@ps4634 init.d]# ./cruisecontrol start
The executable /usr/local/lib/cruise/cruisecontrolrb/ does not exist!
I get this error what does executable means .