#!/sbin/runscript # Copyright 1999-2009 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ pid_file="/var/run/gcaldaemon.pid" JAVA_HOME=/etc/java-config-2/current-system-vm PATH=$JAVA_HOME/bin:$PATH depend() { need net } start() { ebegin "Starting GCALDaemon" /opt/gcaldaemon/bin/standalone-start.sh &> /dev/null & if [ $? -gt 0 ]; then eerror "Start GCALDaemon Failed." else PID=`ps aux | grep -i "java" | grep -i "gcaldaemon" | awk '{print ""$2""}'` echo $PID > $pid_file fi eend ${?} } stop() { ebegin "Stopping GCALDaemon" [ -f $pid_file ] && PID=`cat $pid_file` [ ! -z "$PID" ] || PID=`ps aux | grep -i "java" | grep -i "gcaldaemon" | awk '{print ""$2""}'` [ -z "$PID" ] || kill $PID &> /dev/null if [ $? -gt 0 ]; then eerror "Stop GCALDaemon failed" else rm -f $pid_file fi eend ${?} }