#! /bin/sh
#
# |-----------------------------------------------------------|
# | Copyright (c) 1991, 1990 MIPS Computer Systems, Inc.      |
# | All Rights Reserved                                       |
# |-----------------------------------------------------------|
# |          Restricted Rights Legend                         |
# | Use, duplication, or disclosure by the Government is      |
# | subject to restrictions as set forth in                   |
# | subparagraph (c)(1)(ii) of the Rights in Technical        |
# | Data and Computer Software Clause of DFARS 252.227-7013.  |
# |         MIPS Computer Systems, Inc.                       |
# |         950 DeGuigne Avenue                               |
# |         Sunnyvale, California 94088-3650, USA             |
# |-----------------------------------------------------------|
#
# $Header: smtp,v 1.6.2.1 92/06/24 13:35:05 marker Exp $
#
# Initialize/Shutdown the smtp software.
#

PATH=/net:/bin:/etc:/usr/bin:/usr/etc:/usr/ucb:

case "$1" in
'start')
#
# Have they set the hostname yet.  If not, don't start SMTP.
#
	if [ "`hostname`" = "no_hostname_set" ] ; then
		echo "WARNING: No hostname set.  SMTP not started"
		exit 0
	fi
#
#   Check for existence of sendmail first.
#
    if test ! -x /usr/lib/sendmail -o ! -r /usr/lib/sendmail.cf
    then
	exit 0
    fi
	
    rm -f /usr/spool/mqueue/lf*
    /usr/lib/sendmail -bd -q15m
    ;;

'stop')
    pid=`ps -e | grep ' sendmail$' | sed -e 's/^  *//' -e 's/ .*//'`
    if test "${pid} " != " "
    then
	kill ${pid}
    fi
    ;;

*)
    echo "usage: /etc/init.d/smtp {start|stop}"
    ;;
esac
exit 0
