updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / calendarserver / calendarserver.rc
blob16cfe3edf6c9945e41562f7b30459127ba4f46db
1 #!/bin/bash
3 . /etc/rc.conf
4 . /etc/rc.d/functions
6 PID=`cat /var/run/caldavd/caldavd.pid 2>/dev/null`
7 case "$1" in
8 start)
9 stat_busy "Starting Calendarserver"
10 if [ -z "$PID" ]; then
11 cd /opt/caldavd/CalendarServer
12 USER=root ./run -d >/dev/null 2>/dev/null &
14 if [ ! -z "$PID" ]; then
15 stat_fail
16 else
17 PID=`pidof -o %PPID /usr/bin/caldavd`
18 echo $PID > /var/run/calendarserver.pid
19 add_daemon calendarserver
20 stat_done
23 stop)
24 stat_busy "Stopping Calendarserver"
25 [ ! -z "$PID" ] && kill $PID &> /dev/null
26 if [ $? -gt 0 ]; then
27 stat_fail
28 else
29 rm_daemon calendarserver
30 stat_done
33 restart)
34 $0 stop
35 sleep 1
36 $0 start
39 echo "usage: $0 {start|stop|restart}"
40 esac