Sophie

Sophie

distrib > Mandriva > mes5 > x86_64 > by-pkgid > c27f1e0f7d96064d9cf2f580e1d0b477 > files > 2

mailgraph-1.14-5.1mdvmes5.1.noarch.rpm

#!/bin/bash
#
# mailgraph    Starts and stops the mailgraph daemon.
#
# chkconfig: 2345 82 28
# description: mailgraph postfix log grapher.
# processname: mailgraph
# pidfile: /var/run/mailgraph/mailgraph.pid
# config: /etc/sysconfig/mailgraph

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ "${NETWORKING}" = "no" ] && exit 0

[ -e /etc/sysconfig/mailgraph ] && . /etc/sysconfig/mailgraph

[ -x /usr/sbin/mailgraph ] || exit 0

# See how we were called.
case "$1" in
start)
	echo -n "Starting mailgraph daemon: "
	if [ -f /var/run/mailgraph/mailgraph.pid ]; then
	    echo -n "removing mouldy old pid file"
	    rm -f /var/run/mailgraph/mailgraph.pid
	fi
	daemon nice -20 /usr/sbin/mailgraph \
	--daemon \
	--logfile ${MAILGRAPH_MAIL_LOG:-"/var/log/mail/info"} \
	--daemon-pid=${MAILGRAPH_PID:-"/var/run/mailgraph/mailgraph.pid"} \
	--daemon-rrd=${MAILGRAPH_RRD_DIR:-"/var/lib/mailgraph"} \
	--rrd-name=${MAILGRAPH_RRD_NAME:-"mailgraph"} \
	--daemon-log=${MAILGRAPH_LOG:-"/var/log/mailgraph/mailgraph.log"} \
	${MAILGRAPH_OPTIONS:-""}
	echo
	touch /var/lock/subsys/mailgraph
	;;
stop)
	echo -n "Shutting down mailgraph daemon: "
	killproc mailgraph
	echo
	rm -f /var/lock/subsys/mailgraph
	rm -f /var/run/mailgraph/mailgraph.pid
	;;
status)
	status mailgraph
	;;
restart|reload)
	$0 stop
  	sleep 2
	$0 start
	;;
condrestart)
	[ -f /var/lock/subsys/mailgraph ] && restart
	;;
  *)
	echo "Usage: mailgraph {start|stop|status|restart|condrestart|reload}"
	exit 1
esac

exit 0