diff options
Diffstat (limited to 'scripts/support/etc')
-rw-r--r-- | scripts/support/etc/cron | 18 | ||||
-rw-r--r-- | scripts/support/etc/crontab | 8 | ||||
-rw-r--r-- | scripts/support/etc/install | 67 | ||||
-rw-r--r-- | scripts/support/etc/rc | 198 | ||||
-rw-r--r-- | scripts/support/etc/setup | 72 |
5 files changed, 363 insertions, 0 deletions
diff --git a/scripts/support/etc/cron b/scripts/support/etc/cron new file mode 100644 index 0000000000000..07ed189498357 --- /dev/null +++ b/scripts/support/etc/cron @@ -0,0 +1,18 @@ +#!/bin/sh +# +# cron,v 3.1 1993/07/06 01:10:50 jbj Exp +# +# called by cron for statistics gathering +# +# cron,v +# Revision 3.1 1993/07/06 01:10:50 jbj +# XNTP release 3.1 +# +# +# Revision 1.1 1992/12/10 12:59:18 kardel +# Prerelease NTP V3 / DCF +# +# +PATH="${PATH}:/local/NTP/bin" +export PATH +monl -d /local/NTP/monitor -i '127\.0\.0\.1' faui10 faui45 lucifer rackety.udel.edu diff --git a/scripts/support/etc/crontab b/scripts/support/etc/crontab new file mode 100644 index 0000000000000..2b2d19ced76c7 --- /dev/null +++ b/scripts/support/etc/crontab @@ -0,0 +1,8 @@ +# +# NTP statistics periodic cleanup - REFERENCE SERVER ONLY +# +#55 23 * * * sh /local/NTP/etc/mvstats +# +# gather NTP client statistics - REFERENCE SERVER ONLY +# +0 8,18 * * * /local/NTP/etc/cron 2>/dev/null | /usr/ucb/mail -s "NTP statistics" time@informatik.uni-erlangen.de diff --git a/scripts/support/etc/install b/scripts/support/etc/install new file mode 100644 index 0000000000000..169a7e5a06d74 --- /dev/null +++ b/scripts/support/etc/install @@ -0,0 +1,67 @@ +#!/bin/sh +# +# install,v 3.1 1993/07/06 01:10:53 jbj Exp +# +# install,v +# Revision 3.1 1993/07/06 01:10:53 jbj +# XNTP release 3.1 +# +# +# Revision 1.1 1992/12/10 12:59:21 kardel +# Prerelease NTP V3 / DCF +# +# Revision 1.1 1992/06/18 14:50:08 kardel +# Initial revision +# +# +NTPROOT=/local/NTP # SITE SPECIFIC: where NTP resides +# +# where the local NTP state files reside (xntp.drift) ussualle /etc +# this directory must not be shared as machine dependent data ist stored there +# +NTPDIR="/+private/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 + +Mkdir() { + p="" + IFS="/" + set -- $@ + IFS=' +' + for pnc do + if [ ! -d "$p/$pnc" ]; then + ECHO -n "creating directory $p/$pnc" + if mkdir "$p/$pnc"; then + ECHO "" + else + ECHO " - FAILED" + break; + fi + fi + p="$p/$pnc" + done +} + +if [ ! -d "$NTPDIR" ]; then + ECHO "installing NTP private data area ($NTPDIR)" + if Mkdir "$NTPDIR"; then + chmod 755 "$NTPDIR" + ECHO "$NTPDIR created." + fi +else + ECHO "NTP already installed." + if [ -f "$NTPDIR/xntp.drift" ]; then + ECHO "currently saved drift value:" `cat "$NTPDIR/xntp.drift"` + fi +fi + diff --git a/scripts/support/etc/rc b/scripts/support/etc/rc new file mode 100644 index 0000000000000..ef8834a69f7be --- /dev/null +++ b/scripts/support/etc/rc @@ -0,0 +1,198 @@ +#!/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 diff --git a/scripts/support/etc/setup b/scripts/support/etc/setup new file mode 100644 index 0000000000000..d4ea75ecfaa93 --- /dev/null +++ b/scripts/support/etc/setup @@ -0,0 +1,72 @@ +# +# setup,v 3.1 1993/07/06 01:10:55 jbj Exp +# +# /bin/sh sourced file for environment setup +# expects NTPROOT variable initialized +# +# if not set it will be initialized to /usr/local/NTP +# +# setup,v +# Revision 3.1 1993/07/06 01:10:55 jbj +# XNTP release 3.1 +# +# +# Revision 1.1 1992/12/10 12:59:25 kardel +# Prerelease NTP V3 / DCF +# +# Revision 1.1 1992/12/10 10:14:46 kardel +# Initial revision +# +# +NTPROOT=${NTPROOT-/usr/local/NTP} + +# +# we so use our own echos, as we somes want to substitute them with a +# file logging version durin the /etc/rc.local phase +# +set `type ECHO` + +PATH="${PATH}:$NTPROOT/bin" +export PATH + +if [ "$2" = "is" ]; then + : +else + # + # find out the way echos work (Rest of rc thinks BSD echo) + # + ECHOREP="`echo -n x`" + if [ "$ECHOREP" = "-n x" ]; then + ECHO () { + if [ "$1" = "-n" ]; then + shift + echo "$@\c" + else + echo "$@" + fi + } + #ECHO "System V style echo" + else + ECHO () { + echo "$@" + } + #ECHO "BSD style echo" + fi + + NLECHO () { + echo "$@" + } + + LOG () { + while read _line; do + ECHO "$_line" + done + } + # + # carefully find out some configuration Variables + # + ARCH="`(arch) 2>/dev/null || ((uname) > /dev/null && uname -a | awk '{ print $6; }') 2>/dev/null || echo 'no-arch'`" + KARCH="`(arch -k) 2>/dev/null || ((uname) > /dev/null && uname -a | awk '{ print $5 }') || echo 'no-arch'`" + HOSTNAME="`(hostname) 2>/dev/null || uname -n`" +fi + |