Update TLE files in Gpredict from more than one location …

UPDATE [17 Feb 16]: See my post More on updating TLE files for Gpredict for a newer version of this script (but do read on so you know what it does!)

Gpredict, the free, real-time satellite tracking and orbit prediction software from OZ9AEC is an excellent bit of software for predicting satellite passes if you’re into that sort of thing.  One drawback is that it can only update TLE files from one website which defaults to Celestrak.  Not all the TLEs I needed were available there; the rest I found on the AMSAT website!

I have written a simple shell script to update TLEs from both sites to enable manual import of the TLEs into Gpredict, or optionally copy them to a local Apache web server to point Gpredict’s network download at.

The script also pulls the latest transponder definition files from Gpredict’s git repository and puts them in the ~/.config/Gpredict/trsp directory so you will always have the latest frequencies for the birds.

#! /bin/bash

# Remove old TLE files …
rm ./tle/*

# Bare NASA TLEs from AMSAT …
wget –quiet –show-progress –directory-prefix=./tle http://www.amsat.org/amsat/ftp/keps/current/nasabare.txt

# Get the rest from Celestrak …
wget –quiet –show-progress –directory-prefix=./tle –base http://www.celestrak.com/NORAD/elements/ –input-file celestrak.list

# Uncomment the next line to copy TLE files to local Apache web server …
#sudo cp ./tle/*.txt /var/www/html/keps

# Get updated transponder files from latest gpredict git …

git clone https://github.com/csete/gpredict.git /tmp/gpredict
cp -a /tmp/gpredict/data/trsp/*.trsp ~/.config/Gpredict/trsp/
rm -rf /tmp/gpredict

Copy and paste the script into a file and call it whatever you like.  Just remember to ‘chmod a+x’ it before execution!

There needs to be a plain text file in the same directory that lists the files to retrieve from the Celestrak website.  At the time of writing, the file looks like this …

amateur.txt
argos.txt
beidou.txt
cubesat.txt
dmc.txt
education.txt
engineering.txt
galileo.txt
geo.txt
geodetic.txt
globalstar.txt
glo-ops.txt
goes.txt
gorizont.txt
gps-ops.txt
intelsat.txt
iridium.txt
military.txt
molniya.txt
musson.txt
nnss.txt
noaa.txt
orbcomm.txt
other.txt
other-comm.txt
radar.txt
raduga.txt
resource.txt
sarsat.txt
sbas.txt
science.txt
stations.txt
tdrss.txt
tle-new.txt
visual.txt
weather.txt
x-comm.txt

Save it as ‘celestrak.list’ in the same directory.  You can edit it to your preference as you currently can in Gpredict’s settings.

If you have enabled the optional copy of TLEs to a local webserver, create a directory in your /var/www/html directory called ‘keps’.

Point Gpredict at http://localhost/keps/ and make sure the list of files to retrieve matches the ones you want, ie the files listed above.

Screenshot from 2016-02-16 21-20-18

I have left the option to notify me when the TLEs are out of date to remind me to update them with the script, but you could feasibly run the script with crontab and leave Gpredict to perform an automatic update in the background.  If you do it this way, the transponder file update will probably fail with the script the way it is because it uses the ~ notation for the home directory – crontab will probably not run the script as you, but root!  I need to do a bit more digging to get it working this way, but it works fine for me as it is (for now!)

Advertisements

One thought on “Update TLE files in Gpredict from more than one location …

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s