diff --git a/tracking/update-tracking b/tracking/update-tracking index 46757f0..40410cf 100755 --- a/tracking/update-tracking +++ b/tracking/update-tracking @@ -1,10 +1,21 @@ -DATE=`date -Iseconds` - -rm iridium.txt -wget http://www.celestrak.com/NORAD/elements/iridium.txt -cp iridium.txt tle/iridium-$DATE.txt +#!/bin/sh -rm iridium-NEXT.txt -wget http://www.celestrak.com/NORAD/elements/iridium-NEXT.txt -cp iridium-NEXT.txt tle/iridium-NEXT-$DATE.txt +DATE=`date -Iseconds` +files="iridium-NEXT.txt" +[ ! -z "$1" ] && files="$file iridium.txt tle-new.txt" +for f in $files ; do + if [ -f $f ] ; then + mv $f $f.old + else + touch $f.old + fi + curl -sLO http://celestrak.com/NORAD/elements/$f + if cmp -s $f.old $f ; then + echo "$f is unchanged" + rm $f.old + else + echo "Saving new version of $f" + cp $f tle/${f%.txt}-$DATE.txt + fi +done