#!/bin/sh
#
# chkconfig: 345 55 45
# description: The qmail service provides a Mail Transport Agent (MTA)
#	replacement for sendmail or other mta programs.
#

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

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

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

[ -f /var/qmail/bin/sendmail ] || exit 0

# See how we were called.
case "$1" in
  start)
	# Start daemons.
	echo -n "Starting qmail: "
	PATH="/var/qmail/bin:$PATH"; export PATH
	qmail-start "`cat /etc/qmail/dot-qmail`" splogger qmail &
	echo "qmail"
	touch /var/lock/subsys/qmail
	;;
  stop)
	# Stop daemons.
	echo -n "Shutting down qmail: "
	killproc qmail-send
	echo
	rm -f /var/lock/subsys/qmail
	;;
  *)
	echo "Usage: qmail {start|stop}"
	exit 1
esac

exit 0

