1
0
Fork 0

Check if ST_LOGIN exists

pull/19/head
Cees Bassa 2019-11-02 21:24:57 +01:00
parent a8b02f44b9
commit b72d99a759
1 changed files with 18 additions and 15 deletions

View File

@ -11,27 +11,30 @@ cd $ST_TLEDIR
# Get date # Get date
DATE=`date +%Y%m%d_%H%M%S` DATE=`date +%Y%m%d_%H%M%S`
# Get cookie # Get space-track catalog
wget --post-data=$ST_LOGIN --cookies=on --keep-session-cookies --save-cookies=/tmp/cookies.txt 'https://www.space-track.org/ajaxauth/login' -o /tmp/stget.log if [[ ! -z "${ST_LOGIN}" ]]; then
# Get cookie
wget --post-data=$ST_LOGIN --cookies=on --keep-session-cookies --save-cookies=/tmp/cookies.txt 'https://www.space-track.org/ajaxauth/login' -o /tmp/stget.log
# Get data # Get data
wget --keep-session-cookies --load-cookies=/tmp/cookies.txt 'https://www.space-track.org/basicspacedata/query/class/tle_latest/ORDINAL/1/EPOCH/%3Enow-30/format/3le' -O catalog.tle wget --keep-session-cookies --load-cookies=/tmp/cookies.txt 'https://www.space-track.org/basicspacedata/query/class/tle_latest/ORDINAL/1/EPOCH/%3Enow-30/format/3le' -O catalog.tle
dos2unix catalog.tle dos2unix catalog.tle
# Determine if we have gsed on our system, which probably means that the regular 'sed' # Determine if we have gsed on our system, which probably means that the regular 'sed'
# is BSD sed, which has a differnet syntax. Use GNU sed instead... # is BSD sed, which has a differnet syntax. Use GNU sed instead...
gsed_exists=$(which gsed) gsed_exists=$(which gsed)
if [ -n "$gsed_exists" ]; then if [ -n "$gsed_exists" ]; then
SED=gsed SED=gsed
echo "Using GSED" echo "Using GSED"
else else
SED=sed SED=sed
fi fi
# Fix missing leading zeros # Fix missing leading zeros
$SED -i -e "s/^1 /1 0000/g" -e "s/^2 /2 0000/g" -e "s/^1 /1 000/g" -e "s/^2 /2 000/g" -e "s/^1 /1 00/g" -e "s/^2 /2 00/g" -e "s/^1 /1 0/g" -e "s/^2 /2 0/g" catalog.tle $SED -i -e "s/^1 /1 0000/g" -e "s/^2 /2 0000/g" -e "s/^1 /1 000/g" -e "s/^2 /2 000/g" -e "s/^1 /1 00/g" -e "s/^2 /2 00/g" -e "s/^1 /1 0/g" -e "s/^2 /2 0/g" catalog.tle
cp catalog.tle ${DATE}_catalog.txt cp catalog.tle ${DATE}_catalog.txt
rm login rm login
fi
# Get classfd # Get classfd
wget http://www.prismnet.com/~mmccants/tles/classfd.zip --no-check-certificate -O classfd.zip wget http://www.prismnet.com/~mmccants/tles/classfd.zip --no-check-certificate -O classfd.zip