:
#ident	"@(#)/usr/local/doarchive 1.0 05/30/91" Author: Milton Turner
# Office: HQ ATC/SCDAA, Randolph AFB, Texas 78150
# Phone: AV 487-UNIX (8649)  Comm: (512) 652-UNIX (8649)
#
#help# This script is used to backup tar/compressed archives via Ethernet
#help# or X.25 (DDN).  Its purpose is to nitely pull an archive file or
#help# other file from a remote and store it on a local system.
#help# By modifying the get.scdb file one may use this mechanism to pull
#help# large groups of files also.
#help# The aftp.scdb file is the file that is specific autoftp30.sh that
#help# was customized to do this.  Notice the LocalHost variable is equal
#help# to scdb.guest.  This is the login on the remote.  Also notice in
#help# line 121 and 122 the password entry for remote system.  This may
#help# be any 8 characters, NO SPACES may be used.  The simple file, get.scdb
#help# was constructed to pull the archived file over to the local system.
#help# Of course this pull is dependent on the network being up...
#help# The cron entry on the remote must, of course have the file ready for
#help# transfer it looks like: 49 22 * * * /usr3/archive.scdb 2>/dev/null
#help# and archive.scdb looks like:
#help# The doarchive cron entry on local looks like:
#help# 35 23 * * * /usr3/SCDB/doarchive 2>/dev/null
#help# NOTICE: The timing difference  between remote and local is about 1 hour
#help# to allow remote time to make the file before you "get" it from there.

PATH=:/usr/local:/bin:/usr/bin:.:/etc:
export PATH
cd /usr3/SCDB
#
# Now do all housekeeping for notification on success MT
# Get rid of older versions of archive (older than 3 days) and *msg files
# 2 day find leaves 3 days of file aging. MT
# we run rmold from cron, for some reason it won't run here. ?? MT
#/usr3/SCDB/rmold
./aftp.scdb get.scdb
mv scdb.tar.Z scdb.tar.Z`date +%d`
mv $$msg `date +%m.%d`.msg
#
#  Now notify admin
#
echo "\n\n*******************************************************" >> archive.date
echo "SCTC-1 DATA follows" >> archive.date
ls -l scdb.tar.Z* >> archive.date
tail -12 archive.date > /tmp/b.$$;mv /tmp/b.$$ archive.date	#keep small
echo "AUTOFTP connection to `fgrep $RemoteHost /etc/host` is complete\n
and the results are stored in\n$$.msg in `pwd`" > /tmp/a.$$
cat archive.date >> /tmp/a.$$
cat /tmp/a.$$ | mail milt
/bin/rm /tmp/a.$$
