Sophie

Sophie

distrib > Mandriva > current > x86_64 > by-pkgid > 61daa1a2ae8cac95011264c0e5222492 > files > 1

zarafa-spooler-6.40.0-3mdv2010.1.x86_64.rpm

#!/bin/bash
#
# zarafa-spooler Zarafa Outlook Sharing spooler
#
# chkconfig: - 86 24
# description: The Zarafa spooler is responsible for converting the \
#              zarafa mail to internet format and send it using your \
#              configured SMTP server.
# 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 Outlook Sharing spooler
# Description: The Zarafa spooler is responsible for converting the
#              zarafa mail to internet format and send it using your
#              configured SMTP server.
### 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

	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