head	1.2;
access;
symbols
	RELENG_7_4_0_RELEASE:1.1.1.1.44.1
	RELENG_7_4:1.1.1.1.44.1.0.8
	RELENG_7_4_BP:1.1.1.1.44.1
	RELENG_7_3_0_RELEASE:1.1.1.1.44.1
	RELENG_7_3:1.1.1.1.44.1.0.6
	RELENG_7_3_BP:1.1.1.1.44.1
	RELENG_7_2_0_RELEASE:1.1.1.1.44.1
	RELENG_7_2:1.1.1.1.44.1.0.4
	RELENG_7_2_BP:1.1.1.1.44.1
	RELENG_7_1_0_RELEASE:1.1.1.1.44.1
	RELENG_6_4_0_RELEASE:1.1.1.1.34.1
	RELENG_7_1:1.1.1.1.44.1.0.2
	RELENG_7_1_BP:1.1.1.1.44.1
	RELENG_6_4:1.1.1.1.34.1.0.2
	RELENG_6_4_BP:1.1.1.1.34.1
	RELENG_7_0_0_RELEASE:1.1.1.1
	RELENG_6_3_0_RELEASE:1.1.1.1
	RELENG_7_0:1.1.1.1.0.48
	RELENG_7_0_BP:1.1.1.1
	RELENG_6_3:1.1.1.1.0.46
	RELENG_6_3_BP:1.1.1.1
	RELENG_7:1.1.1.1.0.44
	RELENG_7_BP:1.1.1.1
	RELENG_6_2_0_RELEASE:1.1.1.1
	RELENG_6_2:1.1.1.1.0.42
	RELENG_6_2_BP:1.1.1.1
	RELENG_5_5_0_RELEASE:1.1.1.1
	RELENG_5_5:1.1.1.1.0.40
	RELENG_5_5_BP:1.1.1.1
	RELENG_6_1_0_RELEASE:1.1.1.1
	RELENG_6_1:1.1.1.1.0.38
	RELENG_6_1_BP:1.1.1.1
	RELENG_6_0_0_RELEASE:1.1.1.1
	RELENG_6_0:1.1.1.1.0.36
	RELENG_6_0_BP:1.1.1.1
	RELENG_6:1.1.1.1.0.34
	RELENG_6_BP:1.1.1.1
	RELENG_5_4_0_RELEASE:1.1.1.1
	RELENG_5_4:1.1.1.1.0.32
	RELENG_5_4_BP:1.1.1.1
	RELENG_4_11_0_RELEASE:1.1.1.1
	RELENG_4_11:1.1.1.1.0.30
	RELENG_4_11_BP:1.1.1.1
	RELENG_5_3_0_RELEASE:1.1.1.1
	RELENG_5_3:1.1.1.1.0.28
	RELENG_5_3_BP:1.1.1.1
	RELENG_5:1.1.1.1.0.26
	RELENG_5_BP:1.1.1.1
	v4_2_0:1.1.1.1
	RELENG_4_10_0_RELEASE:1.1.1.1
	RELENG_4_10:1.1.1.1.0.24
	RELENG_4_10_BP:1.1.1.1
	RELENG_5_2_1_RELEASE:1.1.1.1
	RELENG_5_2_0_RELEASE:1.1.1.1
	RELENG_5_2:1.1.1.1.0.22
	RELENG_5_2_BP:1.1.1.1
	RELENG_4_9_0_RELEASE:1.1.1.1
	RELENG_4_9:1.1.1.1.0.20
	RELENG_4_9_BP:1.1.1.1
	RELENG_5_1_0_RELEASE:1.1.1.1
	RELENG_5_1:1.1.1.1.0.18
	RELENG_5_1_BP:1.1.1.1
	RELENG_4_8_0_RELEASE:1.1.1.1
	RELENG_4_8:1.1.1.1.0.16
	RELENG_4_8_BP:1.1.1.1
	RELENG_5_0_0_RELEASE:1.1.1.1
	RELENG_5_0:1.1.1.1.0.14
	RELENG_5_0_BP:1.1.1.1
	v4_1_1b:1.1.1.1
	v4_1_1a:1.1.1.1
	RELENG_4_7_0_RELEASE:1.1.1.1
	RELENG_4_7:1.1.1.1.0.12
	RELENG_4_7_BP:1.1.1.1
	RELENG_4_6_2_RELEASE:1.1.1.1
	RELENG_4_6_1_RELEASE:1.1.1.1
	RELENG_4_6_0_RELEASE:1.1.1.1
	RELENG_4_6:1.1.1.1.0.10
	RELENG_4_6_BP:1.1.1.1
	RELENG_4_5_0_RELEASE:1.1.1.1
	RELENG_4_5:1.1.1.1.0.8
	RELENG_4_5_BP:1.1.1.1
	RELENG_4_4_0_RELEASE:1.1.1.1
	RELENG_4_4:1.1.1.1.0.6
	RELENG_4_4_BP:1.1.1.1
	v4_1_0:1.1.1.1
	RELENG_4_3_0_RELEASE:1.1.1.1
	RELENG_4_3:1.1.1.1.0.4
	RELENG_4_3_BP:1.1.1.1
	RELENG_4_2_0_RELEASE:1.1.1.1
	RELENG_4_1_1_RELEASE:1.1.1.1
	PRE_SMPNG:1.1.1.1
	RELENG_4_1_0_RELEASE:1.1.1.1
	RELENG_4_0_0_RELEASE:1.1.1.1
	RELENG_4:1.1.1.1.0.2
	RELENG_4_BP:1.1.1.1
	v4_0_99b:1.1.1.1
	v4_0_98f:1.1.1.1
	DMILLS:1.1.1;
locks; strict;
comment	@# @;


1.2
date	2008.08.22.15.58.00;	author roberto;	state dead;
branches;
next	1.1;

1.1
date	99.12.09.13.01.07;	author roberto;	state Exp;
branches
	1.1.1.1;
next	;

1.1.1.1
date	99.12.09.13.01.07;	author roberto;	state Exp;
branches
	1.1.1.1.34.1
	1.1.1.1.44.1;
next	;

1.1.1.1.34.1
date	2008.09.04.12.49.54;	author roberto;	state dead;
branches;
next	;

1.1.1.1.44.1
date	2008.09.03.08.49.07;	author roberto;	state dead;
branches;
next	;


desc
@@


1.2
log
@SVN rev 182007 on 2008-08-22 15:58:00Z by roberto

Merge ntpd & friends 4.2.4p5 from vendor/ntp/dist into head.  Next commit
will update usr.sbin/ntp to match this.

MFC after:	2 weeks
@
text
@#!/bin/sh
# NTP time synchronisation
#
# /src/NTP/REPOSITORY/v3/supportscripts/etc/rc,v 1.11 1993/07/09 13:17:00 kardel Exp
#
# rc,v
# Revision 1.11  1993/07/09  13:17:00  kardel
# local NTPROOT
#
# Revision 1.10  1993/07/09  11:37:29  kardel
# Initial restructured version + GPS support
#
# Revision 1.9  1993/06/23  14:10:36  kardel
# June 21st reconcilation
#
# Revision 1.7  1993/06/02  12:04:43  kardel
# May 28th reconcilation & clenaup
#
#
# non reference clock hosts will try to do an ntpdate on NTPSERVERS
#
NTPSERVERS="ntps1-0 ntps1-1 ntps2-0 ntps2-1"
NTPROOT=/local/NTP

#
# get the initial setup
#
if [ ! -r $NTPROOT/etc/setup ]; then
	echo "ERROR: $NTPROOT/etc/setup missing - incorrect installation."
	exit 1
else
	. $NTPROOT/etc/setup
fi

umask 022                           # SITE SPECIFIC: local policy - watch out for NFS and "root" rights

msg=""
#
# default configuration files are named $NTPROOT/conf/<ARCH>.<KARCH>
#
CF=$NTPROOT/conf/$ARCH.$KARCH     # default configuration file
#
# Host specific config file (reference clocks) have the hostname tagged on
#
CFH="$CF"."$HOSTNAME"             # specific configuration file
#
# where to find the tickadj command
#
KFIX=$NTPROOT/bin/tickadj         # kernel variable fix
#
# where to find special tickadj parameters
#
TC=$NTPROOT/conf/tickconf         # special tickadj parameters
#
# where to find the keys file (if not found $KEY.dumb will be used)
#
KEY=$NTPROOT/conf/ntp.keys        # private key file
#
# the daemon
#
XD=$NTPROOT/bin/xntpd             # NTP daemon
#
# HP adjtimed
#
ADJTIMED=$NTPROOT/bin/adjtimed    # HP special (adjtime() emulation)
#
# ntpdate command
#
NTPDATE=$NTPROOT/bin/ntpdate

#
# secondary timed support
# The word "TIMED" must be in the config file for timed to start
# Note that this times is a special version which does not ever set or
# adjust the time. Ask time@@informatik.uni-erlangen.de for patches
#
TIMED=$NTPROOT/bin/timed	  # timed (Berkeley) secondary time service
				  # here used in a *HARMLESS* version
				  # to provide time to "inferior" systems
#
# ISREFHOST is a command that returns exit status 0 for a reference host
# Site specific: sample for dcf77 is given
#
ISREFHOST="[ -f $NTPROOT/.karch.$KARCH/sys/OBJ/parsestreams.o -a -f /dev/refclock-0 ]"
#
# SETUP_REFCLOCK
#
# what to do in order to set up a local reference clock
# usually this will load a STREAMS module or initialize other things
# needed
#
SETUP_REFCLOCK() {
  if modstat | grep -s 'PARSE'; then
	  ECHO "loadable PARSER STREAMS module already loaded."
  else
	  ECHO "attempting to load PARSER STREAMS module..."
	  MDLFILE="/tmp/mdl.$$"
	  if modload $NTPROOT/.karch.$KARCH/sys/OBJ/parsestreams.o -o $MDLFILE 2>&1; then
	    modstat
	  else
	    echo WARNING: load FAILED
	  fi | LOG
	  rm -f $MDLFILE
	  unset MDLFILE
  fi
}

kargs() {
  MATCH=NO
  HOSTID="`(hostid) 2>/dev/null || echo 000000`"
  if [ -r "$TC" ]; then
    exec 0< "$TC"
    while [ "$MATCH" != "YES" ] && read HOST ID PARAM; do
      if [ "$HOST" = "DEFAULT" ]; then
	DEFAULT="$ID $PARAM"
      else
	if [ "$ID" = "$HOSTID" -o "$HOST" = "$HOSTNAME" ]; then
	  echo "$PARAM"
	  MATCH=YES
	fi
      fi
    done
    if [ "$MATCH" != "YES" ]; then
      if [ -z "$DEFAULT" ]; then
	echo "-A -p -s -q";
      else
	echo "$DEFAULT";
      fi
    fi
  else 
    echo "-A -p -s -q";
  fi
}

if [ -x $XD ]; then
  if [ -x "$ADJTIMED" ]; then
     $ADJTIMED && ECHO "adjusttimesupport: adjtimed."
  fi
  #
  # WARNING: check ps command first, or you might kill things you don't want to
  #
  PID="`(ps -efa 2>/dev/null || ps auxww 2>/dev/null || echo "") | grep xntp | grep -v grep | awk '{ print $2 }'`"

  if [ ! -z "$PID" ]; then
    ECHO "killing old NTP daemon (PID=$PID)"
    #
    # enable this after checking for correctness
    # kill $PID
    ECHO "should do a kill $PID, if this is the right PID - check rc script"
  fi
  #
  # try an ntpdate when timeservers are configured
  #
  if [ ! -z "$NTPSERVERS" -a -x $NTPDATE ]; then
	ECHO "NTP initial time setting"
	$NTPDATE -v $NTPSERVERS | LOG
  fi
  #
  # look for reference clock equipment
  #
  if $ISREFHOST; then
	ECHO "REFERENCE CLOCK SUPPORT (initializing...)"
	SETUP_REFCLOCK
  fi

  if [ -r "$CFH" ]; then
    CF="$CFH"
  else
    if [ ! -r "$KEY" ]; then
      KEY="$KEY.dumb"
    fi
  fi

  ECHO "NTP configuration file: $CF"
  ECHO -n "time daemon startup:"

  if [ -r "$CF" ]; then
    if [ -x "$KFIX" ]; then
      KARGS="`kargs`"
      if [ ! -z "$KARGS" ]; then
        $KFIX $KARGS && ECHO -n "tickadj $KARGS"
      fi
    fi
    $XD -c "$CF" -k "$KEY" && ECHO -n ' xntpd'
    if [ -x "$TIMED" ] && grep -s TIMED "$CF"; then
      $TIMED -M -N && ECHO -n ' timed'
    fi
  else
    msg="configuration file ($CF) not present."
  fi
else
  msg="daemon binary ($XD) not present."
fi
ECHO "."

if [ "$msg" ]; then
  NLECHO "WARNING: NO NTP time sychronisation: $msg"
fi
@


1.1
log
@Initial revision
@
text
@@


1.1.1.1
log
@Virgin import of ntpd 4.0.98f
@
text
@@


1.1.1.1.34.1
log
@SVN rev 182752 on 2008-09-04 12:49:54Z by roberto

MFH ntpd 4.2.4p5.

Main difference with the stable/7 merge is that 6.x does not support -lrt and
the corresponding *timer functions.

Approved by:	re (kensmith)
@
text
@@


1.1.1.1.44.1
log
@SVN rev 182716 on 2008-09-03 08:49:07Z by roberto

MFH ntpd 4.2.4p5.

Approved by:	re (kensmith)
@
text
@@

