#!/bin/bash # # zarafa-gateway Zarafa Outlook Sharing POP3/IMAP Gateway # # chkconfig: - 86 24 # description: The Zarafa gateway is responsible for allowing users \ # to access their e-mails in Zarafa using the POP3 or IMAP \ # protocol. # processname: /usr/bin/zarafa-gateway # config: /etc/zarafa/gateway.cfg # pidfile: /var/run/zarafa-gateway.pid ### BEGIN INIT INFO # Provides: zarafa-gateway # 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 POP3/IMAP Gateway # Description: The Zarafa gateway is responsible for allowing users # to access their e-mails in Zarafa using the POP3 or IMAP # protocol. ### END INIT INFO GATEWAYCONFIG=/etc/zarafa/gateway.cfg GATEWAYPROGRAM=/usr/bin/zarafa-gateway # Sanity checks. [ -x $GATEWAYPROGRAM ] || exit 0 GATEWAYCONFIG_OPT="" [ ! -z $GATEWAYCONFIG -a -f $GATEWAYCONFIG ] && GATEWAYCONFIG_OPT="-c $GATEWAYCONFIG" [ -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 gateway=`basename $GATEWAYPROGRAM` lockfile=/var/lock/subsys/$gateway pidfile=/var/run/$gateway.pid start() { # Start in background, always succeeds echo -n $"Starting $gateway: " export LC_ALL=$ZARAFA_LOCALE export LANG=$ZARAFA_LOCALE daemon $GATEWAYPROGRAM $GATEWAYCONFIG_OPT RETVAL=$? unset LC_ALL LANG echo [ $RETVAL -eq 0 ] && touch $lockfile return $RETVAL } stop() { echo -n $"Stopping $gateway: " killproc $GATEWAYPROGRAM RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f $lockfile return $RETVAL } restart() { stop start } reload() { echo -n $"Restarting $gateway: " killproc $GATEWAYPROGRAM -SIGHUP RETVAL=$? echo return $RETVAL } # See how we were called. case "$1" in start) start ;; stop) stop ;; status) status $gateway RETVAL=$? ;; restart|force-reload) restart ;; condrestart|try-restart) if [ -f ${pidfile} ]; then stop start fi ;; reload) reload ;; *) echo $"Usage: $gateway {start|stop|status|reload|restart|condrestart|force-reload|try-restart}" RETVAL=1 ;; esac exit $RETVAL