Created
May 1, 2014 00:12
-
-
Save codemis/febde0a51e68289a5a79 to your computer and use it in GitHub Desktop.
CruiseControl Services
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 | |
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin: | |
. /lib/lsb/init-functions | |
JAVA_HOME=/usr | |
NAME=cruisecontrol | |
DAEMON=/opt/cruisecontrol/cruisecontrol.sh | |
PIDFILE=/opt/cruisecontrol/cc.pid | |
test -x $DAEMON || exit 5 | |
RUNASUSER=cruisecontrol | |
UGID=$(getent passwd $RUNASUSER | cut -f 3,4 -d:) || true | |
case $1 in | |
start) | |
log_daemon_msg "Starting Cruisecontrol server" "cc" | |
if [ -z "$UGID" ]; then | |
log_failure_msg "user \"$RUNASUSER\" does not exist" | |
exit 1 | |
fi | |
cd /opt/cruisecontrol/ | |
./cruisecontrol.sh > /dev/null 2>&1 | |
log_end_msg $? | |
;; | |
stop) | |
log_daemon_msg "Stopping Cruisecontrol server" "cc" | |
start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE | |
log_end_msg $? | |
rm -f $PIDFILE | |
;; | |
restart|force-reload) | |
$0 stop && sleep 2 && $0 start | |
;; | |
status) | |
pidofproc -p $PIDFILE $DAEMON >/dev/null | |
status=$? | |
if [ $status -eq 0 ]; then | |
log_success_msg "Cruisecontrol server is running." | |
else | |
log_failure_msg "Cruisecontrol server is not running." | |
fi | |
exit $status | |
;; | |
*) | |
echo "Usage: $0 {start|stop|restart|force-reload|status}" | |
exit 2 | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment