Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
#!/bin/bash
#
# zarafa-ical Zarafa Collaboration Platoform's iCal Gateway
#
# chkconfig: 345 86 24
# description: The Zarafa iCal Gateway allows users \
# to access their calender 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 Collaboration Platoform's iCal Gateway
# Description: The Zarafa iCal Gateway allows users
# to access their calender 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
echo -n $"Starting $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() {
echo -n $"Stopping $ical: "
killproc $ICALPROGRAM
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f $lockfile $pidfile
return $RETVAL
}
restart() {
stop
start
}
reload() {
echo -n $"Restarting $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
;;
*)
echo $"Usage: $ical {start|stop|status|reload|restart|condrestart|force-reload|try-restart}"
RETVAL=1
;;
esac
exit $RETVAL