Created
August 5, 2010 22:36
-
-
Save thiagomoretto/510518 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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