https://bugzilla.novell.com/show_bug.cgi?id=700267

https://bugzilla.novell.com/show_bug.cgi?id=700267#c0


           Summary: openSUSE:Factory:Contrib/cruisecontrol: Bug
    Classification: openSUSE
           Product: openSUSE.org
           Version: unspecified
          Platform: Other
        OS/Version: openSUSE 11.4
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: 3rd party software
        AssignedTo: [email protected]
        ReportedBy: [email protected]
         QAContact: [email protected]
                CC: [email protected]
          Found By: Other
           Blocker: No


Dear developer.

We decided to use cruisecontrol on 'encfs'-encrypted path, which is not well
supported by your init scripts (cruisecontrol-2.8.4-1.1.noarch.rpm).

Therefore, I'm sending changes we made. They are not perfect, but please, have
a look at them and consider the proposed generalizations in order to simplify
transfer of CC to other path (ideal case is only to change settings in
/etc/default/cruisecontrol).


Unfortunatelly, I cannot append a file with changed files and diffs from
..2.8.4-1.1 rpm. But if you want, I can send it to you to [email protected]
e-mail.

-----
/etc/default/cruisecontrol:

# Run CruiseControl as this user ID (default: ccontrol)
#
# Set this to an empty string to prevent CruiseControl from starting 
# automatically. Think to stop CruiseControl before setting an empty string ;o)
#
CRUISE_USER="cruise"

CRUISE_SPOOL=/home/cruise
CRUISE_PID=${CRUISE_SPOOL}/cc.pid

# Port used for the JMX Http Console
CRUISE_JMX_PORT=8000

# Port used for RMI
CRUISE_RMI_PORT=1099

# Port used for HTTP
CRUISE_WEB_PORT=8080

# The home directory of the Java development kit (JDK).
#JAVA_HOME="/usr/lib/jvm/java-1.5.0-sun"

# Arguments to pass to the CruiseControl script
CRUISE_OPTS="-Xmx256m -Xms256m -server -Xincgc
-Dcc.config.file=${CRUISE_SPOOL}/config.xml -Dcc.artifacts=${CRUISE_SPOOL}
/artifacts -Dcc.projects=${CRUISE_SPOOL}/projects
-Dcc.logdir=${CRUISE_SPOOL}/logs -Dcc.ajp13port=8009 -Dlog4j.configurat
ion=file://${CRUISE_SPOOL}/log4j.properties"

-----
/etc/init.d/cruisecontrol:
#!/bin/bash
#
# Init file for CruiseControl server daemon
#
# chkconfig: 2345 20 80
# description: CruiseControl server daemon
#
### BEGIN INIT INFO
# Provides: cruisecontrol
# Required-Start: $local_fs $network $syslog
# Should-Start: java
# Required-Stop: $null
# Default-Start: 3 5
# Default-Stop: 0 1 2 4 6
# Short-Description: CruiseControl
# Description: CruiseControl
### END INIT INFO

# source function library
if [ -f /lib/lsb/init-functions ]; then 
    . /lib/lsb/init-functions
fi

if [ -f /etc/default/cruisecontrol ]; then
    . /etc/default/cruisecontrol
fi

# DT: Must use values defined in /etc/default/cruisecontrol
CRUISE_PID=${CRUISE_PID:-/var/spool/cruisecontrol/cc.pid}
CRUISE_SPOOL=${CRUISE_SPOOL:-/var/spool/cruisecontrol}

start() {
    # DT: /etc/cruisecontrol/cruisecontrol.xml replaced by
${CRUISE_SPOOL}/config.xml
    # DT: must go to the directory, otherwise CC is started somehow strange ...
    #     It may be enough to set CCHOME, but I'm not sure ...
    CMD="cd $CRUISE_SPOOL; JAVA_HOME=${JAVA_HOME:-/usr}
PATH=${JAVA_HOME:-/usr}/bin:$PATH CC_OPTS=\"${CRUISE_OPTS:-}\" /u
sr/bin/cruisecontrol -configfile ${CRUISE_SPOOL}/config.xml -jmxport
${CRUISE_JMX_PORT:-8000} -rmiport ${CRUISE_RMI_PORT:
-1099} -webport ${CRUISE_WEB_PORT:-8080} -webapppath
/usr/share/cruisecontrol/webapps/cruisecontrol -dashboard /usr/share
/cruisecontrol/webapps/dashboard >/dev/null &"

    pgrep -f cruisecontrol-launcher.jar >/dev/null
    PROCESS_EXIST=$?

    if [ $PROCESS_EXIST -ne 0 ]; then
        if [ "`whoami`" == "${CRUISE_USER:-cruise}" ]; then
            echo -n "Starting Cruise Control..."
            eval ${CMD}
        elif [ "`whoami`" == "root" ]; then
            echo -n "Starting Cruise Control..."
            su -s /bin/sh ${CRUISE_USER:-cruise} -c "${CMD}"
            echo "started."
        else
            echo "You are not root or ${CRUISE_USER:-cruise}, not starting"
        fi
    else
        echo "Cruise Control already started."
        exit
    fi
}

stop() {
    # DT: will fail, if $CRUISE_PID is not accessigle (e.g. encfs-crypted CC
home ...)
    if [ -f $CRUISE_PID ]; then
        PID=`cat $CRUISE_PID`
    fi

    PID_EXISTS=-1
    if [ ! -z $PID ]; then
        ps -p $PID >/dev/null
        PID_EXISTS=$?
    fi

    # DT: If PID not found, use pgrep instead (exactly as in start() section
    #     TODO: check the user -u ${CRUISE_USER:-cruise} as well?
    if [ $PID_EXISTS -ne 0 ] ; then
        PID=$(pgrep -f cruisecontrol-launcher.jar)
        PID_EXISTS=$?
    fi

    if [ $PID_EXISTS -eq 0 ] ; then
        echo "Stopping Cruise Control (process $PID)..."
        kill $PID
    else
        echo "Cruise Control not running..."
    fi
}

case "$1" in
    start)
    start
    ;;
    stop)
    stop
    ;;
    restart)
    stop
    sleep 5
    start
    ;;
    force-reload)
    ;;
    status)

    ;;
    *)
    echo "Usage: $0 [start|stop|restart|force-reload|status]"
    exit 1
esac

exit 0

-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to