#!/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/xntpd,v 1.1 1997/10/09 10:37:09 ang Exp $"
#
#LocINFO Network Time Protocol
#

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 Network Time Protocol
#

case "$1" in

'start')
    cp -p $LOCDB/etc/inet/ntp.conf /etc/inet
    ${SH} /etc/init.d/xntpd $1
    ;;

'stop')
    ${SH} /etc/init.d/xntpd $1
    rm -f /etc/inet/ntp.conf
    ;;

'create')
    echo "/etc/inet\n/etc/inet/ntp.conf" | cpio -pdm $LOCDB 2>/dev/null
    exit `procexist xntpd && [ -f /etc/inet/ntp.conf ]`
    ;;

*)
    echo "Usage: $0 { start | stop }"
    ;;
esac

exit 0
