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.
# Remove old TLE files …
# 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 …
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.
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!)