updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / convergence-server-git / rc.convergence
blob22c8a6abe478ad5d1d01976a45e06df15ed7bc88
1 #!/bin/bash
3 daemon_name=convergence
5 . /etc/rc.conf
6 . /etc/rc.d/functions
7 . /etc/conf.d/$daemon_name.conf
9 get_pid() {
10 pidof -x -o %PPID convergence-notary
13 case "$1" in
14 start)
15 stat_busy "Starting $daemon_name daemon"
17 PID=$(get_pid)
18 if [[ -z $PID ]]; then
19 [[ -f /var/run/$daemon_name.pid ]] &&
20 rm -f /var/run/$daemon_name.pid
21 # RUN
22 convergence-notary -p $PORT -s $SPORT -c $CERTFILE -k $KEYFILE -u $USER -g $GROUP
24 if [[ $? -gt 0 ]]; then
25 stat_fail
26 exit 1
27 else
28 echo $(get_pid) > /var/run/$daemon_name.pid
29 add_daemon $daemon_name
30 stat_done
32 else
33 stat_fail
34 exit 1
38 stop)
39 stat_busy "Stopping $daemon_name daemon"
40 PID=$(get_pid)
41 # KILL
42 [[ -n $PID ]] && kill $PID &> /dev/null
44 if [[ $? -gt 0 ]]; then
45 stat_fail
46 exit 1
47 else
48 rm -f /var/run/$daemon_name.pid &> /dev/null
49 rm_daemon $daemon_name
50 stat_done
54 restart)
55 $0 stop
56 sleep 3
57 $0 start
60 status)
61 stat_busy "Checking $daemon_name status";
62 ck_status $daemon_name
66 echo "usage: $0 {start|stop|restart|status}"
67 esac
69 exit 0
71 # vim:set ts=2 sw=2 et: