lkundrak / rpms / sendmail

Forked from rpms/sendmail 4 years ago
Clone
cvsdist 83f6af4
#!/bin/bash
cvsdist 53226c2
#
cvsdist 53226c2
# sendmail      This shell script takes care of starting and stopping
cvsdist 53226c2
#               sendmail.
cvsdist 53226c2
#
cvsdist 53226c2
# chkconfig: 2345 80 30
cvsdist 53226c2
# description: Sendmail is a Mail Transport Agent, which is the program \
cvsdist 53226c2
#              that moves mail from one machine to another.
cvsdist 53226c2
# processname: sendmail
cvsdist 53226c2
# config: /etc/sendmail.cf
cvsdist 53226c2
# pidfile: /var/run/sendmail.pid
cvsdist 53226c2
cvsdist 53226c2
# Source function library.
cvsdist 849c77a
. /etc/rc.d/init.d/functions
cvsdist 53226c2
cvsdist 53226c2
# Source networking configuration.
cvsdist 53226c2
. /etc/sysconfig/network
cvsdist 53226c2
cvsdist 53226c2
# Source sendmail configureation.
cvsdist 53226c2
if [ -f /etc/sysconfig/sendmail ] ; then
cvsdist 53226c2
	. /etc/sysconfig/sendmail
cvsdist 53226c2
else
cvsdist 53226c2
	DAEMON=no
cvsdist 53226c2
	QUEUE=1h
cvsdist 53226c2
fi
cvsdist 53226c2
cvsdist 53226c2
# Check that networking is up.
cvsdist 53226c2
[ ${NETWORKING} = "no" ] && exit 0
cvsdist 53226c2
cvsdist 53226c2
[ -f /usr/sbin/sendmail ] || exit 0
cvsdist 53226c2
cvsdist 53226c2
RETVAL=0
cvsdist 83f6af4
prog="sendmail"
cvsdist 53226c2
cvsdist 53226c2
start() {
cvsdist 53226c2
	# Start daemons.
cvsdist 53226c2
cvsdist 83f6af4
	echo -n $"Starting $prog: "
cvsdist 53226c2
	/usr/bin/newaliases > /dev/null 2>&1
cvsdist 04a6582
	if test -x /usr/bin/make -a -f /etc/mail/Makefile ; then
cvsdist 98c3f09
	  make -C /etc/mail -s
cvsdist 04a6582
	else
cvsdist 04a6582
	  for i in virtusertable access domaintable mailertable ; do
cvsdist 53226c2
	    if [ -f /etc/mail/$i ] ; then
cvsdist 53226c2
		makemap hash /etc/mail/$i < /etc/mail/$i
cvsdist 53226c2
	    fi
cvsdist 04a6582
	  done
cvsdist 04a6582
	fi
cvsdist 53226c2
	daemon /usr/sbin/sendmail $([ "$DAEMON" = yes ] && echo -bd) \
cvsdist 53226c2
                                  $([ -n "$QUEUE" ] && echo -q$QUEUE)
cvsdist 53226c2
	RETVAL=$?
cvsdist 53226c2
	echo
cvsdist 53226c2
	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/sendmail
cvsdist 53226c2
	return $RETVAL
cvsdist 53226c2
}
cvsdist 53226c2
cvsdist 53226c2
stop() {
cvsdist 53226c2
	# Stop daemons.
cvsdist 83f6af4
	echo -n $"Shutting down $prog: "
cvsdist 53226c2
	killproc sendmail
cvsdist 53226c2
	RETVAL=$?
cvsdist 53226c2
	echo
cvsdist 53226c2
	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/sendmail
cvsdist 53226c2
	return $RETVAL
cvsdist 53226c2
}
cvsdist 53226c2
cvsdist 53226c2
# See how we were called.
cvsdist 53226c2
case "$1" in
cvsdist 53226c2
  start)
cvsdist 53226c2
	start
cvsdist 53226c2
	;;
cvsdist 53226c2
  stop)
cvsdist 53226c2
	stop
cvsdist 53226c2
	;;
cvsdist 53226c2
  restart|reload)
cvsdist 53226c2
	stop
cvsdist 53226c2
	start
cvsdist 53226c2
	RETVAL=$?
cvsdist 53226c2
	;;
cvsdist 53226c2
  condrestart)
cvsdist 53226c2
	if [ -f /var/lock/subsys/sendmail ]; then
cvsdist 53226c2
	    stop
cvsdist 53226c2
	    start
cvsdist 53226c2
	    RETVAL=$?
cvsdist 53226c2
	fi
cvsdist 53226c2
	;;
cvsdist 53226c2
  status)
cvsdist 53226c2
	status sendmail
cvsdist 53226c2
	RETVAL=$?
cvsdist 53226c2
	;;
cvsdist 53226c2
  *)
cvsdist 83f6af4
	echo $"Usage: $0 {start|stop|restart|condrestart|status}"
cvsdist 53226c2
	exit 1
cvsdist 53226c2
esac
cvsdist 53226c2
cvsdist 53226c2
exit $RETVAL