updated on Sun Jan 22 16:00:49 UTC 2012
[aur-mirror.git] / gcaldaemon / gcaldaemon.rcd
blob7fe30c63672f00b0c797ea424d3764763ba01378
1 #!/bin/bash
3 . /etc/rc.conf
4 . /etc/rc.d/functions
6 pid_file="/var/run/gcaldaemon.pid"
7 JAVA_HOME=/opt/java/jre
8 PATH=$JAVA_HOME/bin:/$PATH
10 case "$1" in
11 start)
12 stat_busy "Starting GCALDaemon"
13 /opt/gcaldaemon/bin/standalone-start.sh &> /dev/null &
14 if [ $? -gt 0 ]; then
15 stat_fail
16 else
17 add_daemon gcaldaemon
18 PID=`ps aux | grep -i "java" | grep -i "gcaldaemon" | awk '{print ""$2""}'`
19 echo $PID > $pid_file
20 stat_done
23 stop)
24 stat_busy "Stopping GCALDaemon"
25 [ -f $pid_file ] && PID=`cat $pid_file`
26 [ ! -z "$PID" ] || PID=`ps aux | grep -i "java" | grep -i "gcaldaemon" | awk '{print ""$2""}'`
27 [ -z "$PID" ] || kill $PID &> /dev/null
28 if [ $? -gt 0 ]; then
29 stat_fail
30 else
31 rm_daemon gcaldaemon
32 rm -f $pid_file
33 stat_done
36 restart)
37 $0 stop
38 sleep 1
39 $0 start
42 echo "usage: $0 {start|stop|restart}"
43 esac
44 exit 0