updated on Thu Jan 19 04:14:35 UTC 2012
[aur-mirror.git] / coherence / coherence.rc
blobb74504dc740ea72011c6080a4621310c6a70a442
1 #!/bin/bash
3 daemon_name=coherence
4 configfile="/etc/coherence.conf"
5 pidfile=/var/run/$daemon_name.pid
6 daemon_args="-d -c ${configfile}"
8 . /etc/rc.conf
9 . /etc/rc.d/functions
11 case "$1" in
12 start)
13 stat_busy "Starting Coherence daemon"
14 if [ -z `pidof -o %PPID -x $daemon_name` ]; then
15 [ -f ${pidfile} ] && rm -f ${pidfile}
16 # RUN
17 /usr/bin/$daemon_name $daemon_args
19 if [ $? -gt 0 ]; then
20 stat_fail
21 exit 1
22 else
23 add_daemon $daemon_name
24 pidof -o %PPID -x $daemon_name > ${pidfile}
25 stat_done
27 else
28 stat_fail
29 exit 1
33 stop)
34 stat_busy "Stopping Coherence daemon"
35 # KILL
36 [ -f ${pidfile} ] && kill `cat ${pidfile}` >/dev/null 2>&1
38 if [ $? -gt 0 ]; then
39 stat_fail
40 exit 1
41 else
42 rm -f ${pidfile}
43 rm_daemon $daemon_name
44 stat_done
48 restart)
49 $0 stop
50 sleep 3
51 $0 start
54 echo "usage: $0 {start|stop|restart}"
55 esac
57 exit 0