#!/bin/sh 
#
# ident "@(#) update_hosts 1.1 /dsk2/users/len/named/sol251/SCCS/s.update_hosts"
# ident "@(#) Last modified 09/30/96 18:02:51"
#
# AUTHOR:	Leonard Giambrone	09/19/96
#
# NAME: 	update_hosts
#
# USAGE:	update_hosts
#
# DESCRIPTION:
#
#
# This script ftps to $HOST, changes the directory to $DIR, and does an
# ASCII transfer of the remote file $REM_FILE, renaming it to $LOC_FILE
# on the local machine.  The IP address is used for $HOST in case name
# service is currently down.
#
#
# FILES ACCESSED:
#
# See Global Variables section for Variable reference.
# Files which have w access may be created or deleted.
#
# Filename					Access
# --------                      		-----
#
# hosts.master					  w
#
#
# NON OPERATING SYSTEM PROGRAMS CALLED:
#
# EXIT CODES:
#
#		0	Successful execution
#
# HISTORY:
#
# 09/19/96 	ltg	Initial Version
#
# -----------------------------------------------------------------------------

# Global Variables

DEBUG=${DEBUG:-0}
HOSTIP="204.178.40.3"
HOSTNAME="wak.analogic.com"
USER=decnet
PASS=" "
DIR="dr:[sys0.tcpip]"
REMFILE="hosts."
LOCFILE="hosts.master"


# -----------------------------------------------------------------------------
# Main Routine
# -----------------------------------------------------------------------------

if [ "$DEBUG" -eq 1 ]; then
   set -xv
fi

if [ -f "$LOCFILE" ]; then
   /bin/rm "$LOCFILE"
fi

echo "Obtaining latest copy of hosts file:"
echo "ftp'ing to $HOSTNAME...\c"

ftp -n "$HOSTIP" <<END
user "$USER" "$PASS"
cd "$DIR"
get "$REMFILE" "$LOCFILE"
END

echo "Got it."
