/[PAMELA software]/chewbacca/YodaProfiler/docs/retrieve_TLE.sh
ViewVC logotype

Diff of /chewbacca/YodaProfiler/docs/retrieve_TLE.sh

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4 by mocchiut, Tue Mar 27 08:34:20 2012 UTC revision 1.7 by mocchiut, Mon Sep 2 14:50:36 2013 UTC
# Line 7  Line 7 
7  # Modified by Emiliano Mocchiutti 2006/10/17  # Modified by Emiliano Mocchiutti 2006/10/17
8  #  #
9    
10  USER=pam2006  #USER=pam2006
11  PASS=Resurs05  #PASS=Resurs05
12  OUTFILE=tle.txt  OUTFILE=tle.txt
13  FORCE="no"  FORCE="no"
14    
# Line 21  if [ $# -gt 0 ]; then Line 21  if [ $# -gt 0 ]; then
21              echo ""              echo ""
22              echo " Options: "              echo " Options: "
23              echo ""              echo ""
24              echo " --user=username : spacetrack username [default pam2006] "  #           echo " --user=username : spacetrack username [default pam2006] "
25              echo ""  #           echo ""
26              echo " --psw=password :  spacetrack password [default Resurs150606]"  #           echo " --psw=password :  spacetrack password [default Resurs150606]"
27              echo ""  #           echo ""
28              echo " --output=filename : output filename [default tle.txt]"              echo " --output=filename : output filename [default tle.txt]"
29              echo ""              echo ""
30              echo " --force : override existing output file [default no]"              echo " --force : override existing output file [default no]"
# Line 36  if [ $# -gt 0 ]; then Line 36  if [ $# -gt 0 ]; then
36              fi              fi
37              exit 0              exit 0
38          fi          fi
39          TEST=`echo $INPUT | sed 's/--user=//g'`  #       TEST=`echo $INPUT | sed 's/--user=//g'`
40          if [ $TEST != $INPUT  ]; then  #       if [ $TEST != $INPUT  ]; then
41              USER=`echo $TEST`  #           USER=`echo $TEST`
42              export USER;  #           export USER;
43          fi  #       fi
44          TEST=`echo $INPUT | sed 's/--psw=//g'`  #       TEST=`echo $INPUT | sed 's/--psw=//g'`
45          if [ $TEST != $INPUT  ]; then  #       if [ $TEST != $INPUT  ]; then
46              PASS=`echo $TEST`  #           PASS=`echo $TEST`
47              export PASS;  #           export PASS;
48          fi  #       fi
49          TEST=`echo $INPUT | sed 's/--output=//g'`          TEST=`echo $INPUT | sed 's/--output=//g'`
50          if [ $TEST != $INPUT  ]; then          if [ $TEST != $INPUT  ]; then
51              OUTFILE=`echo $TEST`              OUTFILE=`echo $TEST`
# Line 80  echo " Today is $YEAR/$MONTH/$DAY" Line 80  echo " Today is $YEAR/$MONTH/$DAY"
80    
81  echo ""  echo ""
82  echo " Setting cookies to connect to spacetrack "  echo " Setting cookies to connect to spacetrack "
83  wget -o /dev/null -O /dev/null --save-cookies .cookies.txt \  wget  --post-data='identity=pam2006&password=Resurs05' --cookies=on --keep-session-cookies --save-cookies=.cookies.txt 'https://www.space-track.org/ajaxauth/login' -o/dev/null
84  https://www.space-track.org/perl/login.pl --post-data="_submitted=1&username=$USER&password=$PASS"  #wget -o /dev/null -O /dev/null --no-check-certificate --save-cookies .cookies.txt \
85    #"https://www.space-track.org/perl/login.pl?_submitted=1&username=$USER&password=$PASS"
86  echo " Done!"  echo " Done!"
87  echo ""  echo ""
88    
89  echo " Retrieving Resurs-DK1 TLEs 2006-2009"  echo " Retrieving Resurs-DK1 TLEs 2006-2009"
90  wget -o /dev/null -O - --load-cookies .cookies.txt \  wget -o /dev/null -O - --limit-rate=100K --no-check-certificate --load-cookies .cookies.txt \
91  --save-cookies .cookies.txt --keep-session-cookies \  --save-cookies .cookies.txt --keep-session-cookies \
92  https://www.space-track.org/perl/id_query.pl --post-data="_submitted=1&_sessionid=&ids=29228&timeframe=timespan&start_year=2006&start_month=6&start_day=14&end_year=2009&end_month=12&end_day=31&common_name=yes&sort=&descending=&ascii=yes&_submit=Submit&_reset=Reset" \  "https://www.space-track.org/basicspacedata/query/class/tle/EPOCH/2006-06-14--2009-12-31/NORAD_CAT_ID/29228/orderby/TLE_LINE1 ASC/format/3le"\
93    #"https://www.space-track.org/perl/id_query.pl?_submitted=1&_sessionid=&ids=29228&timeframe=timespan&start_year=2006&start_month=6&start_day=14&end_year=2009&end_month=12&end_day=31&common_name=yes&sort=&descending=&ascii=yes&_submit=Submit&_reset=Reset "\
94  | egrep "1|2|R" > .tleretrieved.txt  | egrep "1|2|R" > .tleretrieved.txt
95  echo " Retrieving Resurs-DK1 TLEs 2010-2011"  echo " Retrieving Resurs-DK1 TLEs 2010-2011"
96  wget -o /dev/null -O - --load-cookies .cookies.txt \  wget -o /dev/null -O - --limit-rate=100K --no-check-certificate --load-cookies .cookies.txt \
97  --save-cookies .cookies.txt --keep-session-cookies \  --save-cookies .cookies.txt --keep-session-cookies \
98  https://www.space-track.org/perl/id_query.pl --post-data="_submitted=1&_sessionid=&ids=29228&timeframe=timespan&start_year=2010&start_month=1&start_day=1&end_year=2011&end_month=12&end_day=31&common_name=yes&sort=&descending=&ascii=yes&_submit=Submit&_reset=Reset" \  "https://www.space-track.org/basicspacedata/query/class/tle/EPOCH/2010-01-01--2011-12-31/NORAD_CAT_ID/29228/orderby/TLE_LINE1 ASC/format/3le"\
99    #"https://www.space-track.org/perl/id_query.pl?_submitted=1&_sessionid=&ids=29228&timeframe=timespan&start_year=2010&start_month=1&start_day=1&end_year=2011&end_month=12&end_day=31&common_name=yes&sort=&descending=&ascii=yes&_submit=Submit&_reset=Reset"\
100  | egrep "1|2|R" >> .tleretrieved.txt  | egrep "1|2|R" >> .tleretrieved.txt
101  echo " Retrieving Resurs-DK1 TLEs >=2012"  echo " Retrieving Resurs-DK1 TLEs >=2012"
102  wget -o /dev/null -O - --load-cookies .cookies.txt \  wget -o /dev/null -O - --limit-rate=100K --no-check-certificate --load-cookies .cookies.txt \
103  --save-cookies .cookies.txt --keep-session-cookies \  --save-cookies .cookies.txt --keep-session-cookies \
104  https://www.space-track.org/perl/id_query.pl --post-data="_submitted=1&_sessionid=&ids=29228&timeframe=timespan&start_year=2012&start_month=1&start_day=1&end_year=$YEAR&end_month=$MONTH&end_day=$DAY&common_name=yes&sort=&descending=&ascii=yes&_submit=Submit&_reset=Reset" \  "https://www.space-track.org/basicspacedata/query/class/tle/EPOCH/2012-01-01--$YEAR-$MONTH-$DAY/NORAD_CAT_ID/29228/orderby/TLE_LINE1 ASC/format/3le"\
105    #"https://www.space-track.org/perl/id_query.pl?_submitted=1&_sessionid=&ids=29228&timeframe=timespan&start_year=2012&start_month=1&start_day=1&end_year=$YEAR&end_month=$MONTH&end_day=$DAY&common_name=yes&sort=&descending=&ascii=yes&_submit=Submit&_reset=Reset "\
106  | egrep "1|2|R" >> .tleretrieved.txt  | egrep "1|2|R" >> .tleretrieved.txt
107  echo " Done!"  echo " Done!"
108  echo ""  echo ""
# Line 107  CHECK=`grep -i resurs .tleretrieved.txt Line 111  CHECK=`grep -i resurs .tleretrieved.txt
111  if [[ `wc -l < .tleretrieved.txt` -le 2 ]] || [ "$CHECK" == "" ]; then # no tle  if [[ `wc -l < .tleretrieved.txt` -le 2 ]] || [ "$CHECK" == "" ]; then # no tle
112      echo "ERROR: No tle retrieved from spacetrack.org"      echo "ERROR: No tle retrieved from spacetrack.org"
113      echo ""      echo ""
114      rm -f .cookies.txt  #    rm -f .cookies.txt
115      rm -f .tleretrieved.txt  #    rm -f login
116    #    rm -f .tleretrieved.txt
117      exit 1      exit 1
118  fi  fi
119    
120  cp .tleretrieved.txt $OUTFILE  #cp .tleretrieved.txt $OUTFILE
121    
122    cat .tleretrieved.txt | sed 's/0 RESURS DK-1/RESURS DK-1/g' | sed -e 's/\r//g' > $OUTFILE
123    
124  echo " File saved as $OUTFILE"  echo " File saved as $OUTFILE"
125  echo ""  echo ""
126    rm -f login
127  rm -f .cookies.txt  rm -f .cookies.txt
128  rm -f .tleretrieved.txt  rm -f .tleretrieved.txt
129  exit 0  exit 0

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.7

  ViewVC Help
Powered by ViewVC 1.1.23