here is a copy of my init script, i think i got it from a sample dir 
somewhere.



#!/usr/bin/env ruby
#
# chkconfig: 345 94 16
# description: Startup script for CruiseControl.rb

# in order to make cruise run as daemon, you need:
# 1. cp $CCRB_HOME/daemon/cruise.sample $CCRB_HOME/daemon/cruise
# 2. specify your cruise_path to $CCRB_HOME in $CCRB_HOME/daemon/cruise file
# 3. ln -s $CCRB_HOME/daemon/cruise /etc/init.d/cruise (you may need to 
'sudo' this)
# 4. update-rc.d cruise (you may want to choose options by yourself, and 
you may need to 'sudo' this)
# 5. it's done :>

require "fileutils"
include FileUtils

require "rubygems"

begin
  gem 'mongrel'
rescue => e
  puts "Error: daemon mode of CC.rb requires mongrel installed"
  exit 1
end

def cruise_path
  "/var/www/apps/cruisecontrol"
end

command = ARGV.shift

case command
when 'start'
  cd cruise_path
  system "/bin/su -c '/var/www/apps/cruisecontrol/cruise start -d' - deploy"
  exit 0
when 'stop'
  system "mongrel_rails stop -P #{cruise_path}/tmp/pids/mongrel.pid"
  Dir["#{cruise_path}/tmp/pids/builders/*.pid"].each do |pid_file|
    pid = File.open(pid_file){|f| f.read }
    system "kill -9 #{pid}"
    rm pid_file
  end
  exit 0
else
  p "Usage: /etc/init.d/cruise start|stop"
  exit 1
end
_______________________________________________
Cruisecontrolrb-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/cruisecontrolrb-users

Reply via email to