#! /bin/csh
#
# gettle      -----      Manfred Bester  24Oct94
#
# This C shell script can be invoked manually or by cron at a specified time.
# It calls up 'archive.afit.af.mil' (129.92.1.66) and gets the most recent 
# files with Keplerian two-line element sets, as used with SatTrack. 
# After placing the files into SatTrack/tle, program 'tlexgen' is invoked. 
# This program generates an extra file 'tlex.dat' with extended two-line 
# element sets. It basically concatenates several tle files into a larger data 
# base which is used in turn as the default data base for SatTrack. Duplicate 
# entries are eliminated by the object number. The tle files that are 
# concatenated are specified in the input file 'tlelist.dat' in SatTrack/data. 
# Finally, program 'selectsat' is invoked to generate an abbreviated list of 
# two-line element sets for a specified satellite group (e.g. am, sci, wx), 
# which may be used for further distribution to users interested in that 
# particular satellite group. 
#
# If SatTrack is not installed in the user's home directory, the variable 
# 'satdir' needs to be changed to the name of the directory that SatTrack is 
# installed under.
#
set ftphost=129.92.1.66
set userid=$USER@`hostname`.`domainname`
set satdir=$HOME
#
cd $satdir/SatTrack/tle
#
if ($1 == -v) then 
    echo $userid
    echo calling $ftphost ...
endif
#
ftp $1 -n $ftphost << !
user anonymous -$userid
cd /pub/space
get tle.new
get gorizont.tle
get other.tle
get tvro.tle
get visual.tle
quit
!
#
if ($1 == -v) then 
    echo saving data files ...
endif
#
"cp" tle.dat tle.bak
"mv" tle.new tle.dat
"mv" gorizont.tle gorizont.dat
"mv" other.tle debris.dat
"mv" tvro.tle tvro.dat
"mv" visual.tle visual.dat
#
if ($1 == -v) then 
    echo running 'maketlex' ...
endif
#
$satdir/SatTrack/run/maketlex
#
if ($1 == -v) then 
    echo running 'maketles' ...
endif
#
$satdir/SatTrack/run/maketles am
#
if ($1 == -v) then 
    echo running 'satfilter' ...
endif
#
$satdir/SatTrack/run/satfilter leoe
$satdir/SatTrack/run/satfilter leom
$satdir/SatTrack/run/satfilter leop
#
