#!/bin/bash # # zarafa-ical Zarafa Outlook Sharing ICal Gateway # # chkconfig: - 86 24 # description: The Zarafa ICal gateway is responsible for allowing \ # users to access their calender in Zarafa using the ICal \ # or CalDAV protocol. # processname: /usr/bin/zarafa-ical # config: /etc/zarafa/ical.cfg # pidfile: /var/run/zarafa-ical.pid ### BEGIN INIT INFO # Provides: zarafa-ical # Required-Start: $local_fs $network $remote_fs $syslog # Required-Stop: $local_fs $network $remote_fs $syslog # Should-Start: zarafa-server # Should-Stop: zarafa-server # Short-Description: Zarafa Outlook Sharing ICal Gateway # Description: The Zarafa ICal gateway is responsible for allowing # users to access their calender in Zarafa using the ICal # or CalDAV protocol. ### END INIT INFO ICALCONFIG=/etc/zarafa/ical.cfg ICALPROGRAM=/usr/bin/zarafa-ical # Sanity checks. [ -x $ICALPROGRAM ] || exit 0 ICALCONFIG_OPT="" [ ! -z $ICALCONFIG -a -f $ICALCONFIG ] && ICALCONFIG_OPT="-c $ICALCONFIG" [ -f /etc/sysconfig/zarafa ] && . /etc/sysconfig/zarafa if [ -z "$ZARAFA_LOCALE" ]; then ZARAFA_LOCALE="C" fi # Source function library. . /etc/rc.d/init.d/functions RETVAL=0 ical=`basename $ICALPROGRAM` lockfile=/var/lock/subsys/$ical pidfile=/var/run/$ical.pid start() { # Start in background, always succeeds gprintf "Starting %s: " "$ical" export LC_ALL=$ZARAFA_LOCALE export LANG=$ZARAFA_LOCALE daemon $ICALPROGRAM $ICALCONFIG_OPT RETVAL=$? unset LC_ALL LANG echo [ $RETVAL -eq 0 ] && touch $lockfile return $RETVAL } stop() { gprintf "Stopping %s: " "$ical" killproc $ICALPROGRAM RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f $lockfile return $RETVAL } restart() { stop start } reload() { gprintf "Restarting %s: " "$ical" killproc $ICALPROGRAM -SIGHUP RETVAL=$? echo return $RETVAL } # See how we were called. case "$1" in start) start ;; stop) stop ;; status) status $ical RETVAL=$? ;; restart|force-reload) restart ;; condrestart|try-restart) if [ -f ${pidfile} ]; then stop start fi ;; reload) reload ;; *) gprintf "Usage: %s {start|stop|status|reload|restart|condrestart|force-reload|try-restart}\n" "$ical" RETVAL=1 ;; esac exit $RETVAL