#!/bin/sh
#
# Copyright (c) 1993, by Sun Microsystems, Inc.
#
#ident	"$Header: /net/projects/S2.6/cvs/os_net/src_ws/usr/src/tadcmd/locations/init.d/sendmail,v 1.1 1997/10/09 10:37:06 ang Exp $"
#
#LocINFO Sendmail Daemon
#

procexist() {
    pid=`/usr/bin/ps -e | /usr/bin/grep " ${1}$" |
	     /usr/bin/sed -e 's/^  *//' -e 's/ .*//'`
    if [ -z "$pid" ]
    then
	return 1
    fi
    return 0
}

#
# Start/stop lp
#

case "$1" in

'start')
    cp -p $LOCDB/etc/mail/sendmail.cf /etc/mail
    ${SH} /etc/init.d/sendmail $1
    ;;

'stop')
    ${SH} /etc/init.d/sendmail $1
    rm -f /etc/mail/sendmail.cf
    ;;

'create')
    echo "/etc/mail\n/etc/mail/sendmail.cf" | cpio -pdmu $LOCDB 2>/dev/null
    exit `procexist sendmail && [ -f /etc/mail/sendmail.cf ]`
    ;;

*)
    echo "Usage: $0 { start | stop | create }" 1>&2
    ;;
esac

exit 0
