Sophie

Sophie

distrib > Mandriva > 2011.0 > x86_64 > media > contrib-testing > by-pkgid > ca374b9868e48dcce10666ca5ae36c85 > files > 1

zarafa-spooler-7.0.8-1.x86_64.rpm

#!/bin/bash
#
# zarafa-spooler Zarafa Collaboration Server's Spooler Daemon
#
# chkconfig: - 86 24
# description: The Zarafa Spooler is responsible for converting \
#              MAPI messages to the internet format and sending \
#              using your MTA as configured.
# processname: /usr/bin/zarafa-spooler
# config: /etc/zarafa/spooler.cfg
# pidfile: /var/run/zarafa-spooler.pid

### BEGIN INIT INFO
# Provides: zarafa-spooler
# 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 Server's Spooler Daemon
# Description: The Zarafa Spooler is responsible for converting
#              MAPI messages to the internet format and sending
#              using your MTA as configured.
### END INIT INFO

SPOOLERCONFIG=/etc/zarafa/spooler.cfg
SPOOLERPROGRAM=/usr/bin/zarafa-spooler

# Sanity checks.
[ -x $SPOOLERPROGRAM ] || exit 0

SPOOLERCONFIG_OPT=""
[ ! -z $SPOOLERCONFIG -a -f $SPOOLERCONFIG ] && SPOOLERCONFIG_OPT="-c $SPOOLERCONFIG"

[ -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
spooler=`basename $SPOOLERPROGRAM`
lockfile=/var/lock/subsys/$spooler
pidfile=/var/run/$spooler.pid

start() {
	# Start in background, always succeeds
	gprintf "Starting %s: " "$spooler"
	export LC_ALL=$ZARAFA_LOCALE
	export LANG=$ZARAFA_LOCALE
	daemon $SPOOLERPROGRAM $SPOOLERCONFIG_OPT
	RETVAL=$?
	unset LC_ALL LANG
	echo
	[ $RETVAL -eq 0 ] && touch $lockfile

	return $RETVAL
}

stop() {
	gprintf "Stopping %s: " "$spooler"
	killproc $SPOOLERPROGRAM
	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && rm -f $lockfile $pidfile

	return $RETVAL
}

restart() {
	stop
	start
}

reload() {
	gprintf "Restarting %s: " "$spooler"
	killproc $SPOOLERPROGRAM -SIGHUP
	RETVAL=$?
	echo

	return $RETVAL
}

# See how we were called.
case "$1" in
    start)
		start
		;;
    stop)
		stop
		;;
    status)
		status $spooler
		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" "$spooler"
		RETVAL=1
		;;
esac

exit $RETVAL