updated on Sat Jan 14 00:11:12 UTC 2012
[aur-mirror.git] / cruisecontrol-bin / cruisecontrol.init
blob6a0de5bbf3f5ab2da632eba4c13c5585957491da
1 #!/bin/bash
3 . /etc/rc.conf
4 . /etc/rc.d/functions
6 PIDFILE="/var/run/cruisecontrol.pid"
7 PID=`cat $PIDFILE 2>/dev/null`
9 case "$1" in
10 start)
11 stat_busy "Starting CruiseControl"
13 cd /opt/cruisecontrol/ && su cruisecontrol -c '/opt/cruisecontrol/cruisecontrol.sh &>/var/log/cruisecontrol.log'
15 PID=`cat $PIDFILE 2>/dev/null`
16 ps -p $PID &>/dev/null
18 if [ -z "$PID" -o $? -gt 0 ]; then
19 stat_fail
20 else
21 add_daemon cruisecontrol
22 stat_done
25 stop)
26 stat_busy "Stopping CruiseControl"
28 [ ! -z "$PID" ] && kill $PID &>/dev/null
30 if [ $? -gt 0 ]; then
31 stat_fail
32 else
33 rm_daemon cruisecontrol
34 stat_done
37 restart)
38 $0 stop
39 sleep 1
40 $0 start
43 echo "usage: $0 {start|stop|restart}"
44 esac