0
+# Provides: cruisecontrol.rb
0
+# Required-Start: $local_fs $remote_fs
0
+# Required-Stop: $local_fs $remote_fs
0
+# Default-Start: 2 3 4 5
0
+# Default-Stop: S 0 1 6
0
+# Short-Description: CruiseControl.rb
0
+# Description: Continuous build integration system. This runs the web interface (via mongrel and the builders).
0
+# Author: Aaron Bedra <aaron@thinkrelevance.com>
0
+# Please remove the "Author" lines above and replace them
0
+# with your own name if you copy and modify this script.
0
+# PATH should only include /usr/* if it runs after the mountnfs.sh script
0
+PATH=/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/bin:/var/lib/gems/1.8/bin/
0
+CCRBDIR=/home/cruise/cruisecontrolrb/
0
+DESC="Continous Integration"
0
+SCRIPTNAME=/etc/init.d/$NAME
0
+# Read configuration variable file if it is present
0
+[ -r /etc/default/$NAME ] && . /etc/default/$NAME
0
+EXTRAARGS="--chuid $CCRBUSER --chdir $CCRBDIR --quiet $EXTRAARGS"
0
+PIDFILE=$CCRBDIR/tmp/pids/mongrel.pid
0
+BUILDER_PIDS=$CCRBDIR/tmp/pids/builders
0
+# Exit if the package is not installed
0
+[ -x "$DAEMON" ] || exit 0
0
+# Load the VERBOSE setting and other rcS variables
0
+[ -f /etc/default/rcS ] && . /etc/default/rcS
0
+# Define LSB log_* functions.
0
+# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
0
+. /lib/lsb/init-functions
0
+# Function that starts the daemon/service
0
+ # 0 if daemon has been started
0
+ # 1 if daemon was already running
0
+ # 2 if daemon could not be started
0
+ start-stop-daemon --start --pidfile $PIDFILE $EXTRAARGS --exec $DAEMON --test > /dev/null \
0
+ start-stop-daemon --start --pidfile $PIDFILE $EXTRAARGS --exec $DAEMON -- \
0
+ # Add code here, if necessary, that waits for the process to be ready
0
+ # to handle requests from services started subsequently which depend
0
+ # on this one. As a last resort, sleep for some time.
0
+# Function that stops the daemon/service
0
+ # 0 if daemon has been stopped
0
+ # 1 if daemon was already stopped
0
+ # 2 if daemon could not be stopped
0
+ # other if a failure occurred
0
+ start-stop-daemon --stop --retry=TERM/30/KILL/5 --pidfile $PIDFILE
0
+ [ "$RETVAL" = 2 ] && return 2
0
+ for BPID in `ls $BUILDER_PIDS/*.pid`; do
0
+ start-stop-daemon --stop --signal KILL --pidfile "$BPID"
0
+ [ "$?" = 2 ] && return 2
0
+ # Many daemons don't delete their pidfiles when they exit.
0
+# Function that sends a SIGHUP to the daemon/service
0
+ # If the daemon can reload its configuration without
0
+ # restarting (for example, when it is sent a SIGHUP),
0
+ # then implement that here.
0
+ start-stop-daemon --stop --signal 1 --pidfile $PIDFILE
0
+ log_daemon_msg "Starting $DESC" "$NAME"
0
+ 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
0
+ 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
0
+ log_daemon_msg "Stopping $DESC" "$NAME"
0
+ 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
0
+ 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
0
+ # If do_reload() is not implemented then leave this commented out
0
+ # and leave 'force-reload' as an alias for 'restart'.
0
+ #log_daemon_msg "Reloading $DESC" "$NAME"
0
+ # If the "reload" option is implemented then remove the
0
+ # 'force-reload' alias
0
+ log_daemon_msg "Restarting $DESC" "$NAME"
0
+ 1) log_end_msg 1 ;; # Old process is still running
0
+ *) log_end_msg 1 ;; # Failed to start
0
+ #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
0
+ echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
Comments
No one has commented yet.