Skip to content

Instantly share code, notes, and snippets.

@thiagomoretto
Created August 5, 2010 22:36
Show Gist options
  • Save thiagomoretto/510518 to your computer and use it in GitHub Desktop.
Save thiagomoretto/510518 to your computer and use it in GitHub Desktop.
#!/bin/sh
USER=ruby
case "$1" in
start)
echo "Starting CruiseControl.rb..."
su - $USER -c 'rvm use 1.8.7@ci && /home/ruby/ci/cruisecontrol/cruise start -d'
;;
stop)
echo "Stopping CruiseControl.rb..."
PID=`ps ax | grep "cruise start" | cut -c1-5`
if [ -n "$PID" ]
then
su - $USER -c "kill -15 $PID";
sleep 3;
su - $USER -c "kill -9 $PID";
fi
exit 0
;;
*)
echo "Usage: /etc/init.d/cruise {start|stop}"
exit 1
;;
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment