Skip to content

Instantly share code, notes, and snippets.

@km4ack
Created December 18, 2018 19:31
Show Gist options
  • Save km4ack/2b5db90724cab67ed50cbf48ed223efd to your computer and use it in GitHub Desktop.
Save km4ack/2b5db90724cab67ed50cbf48ed223efd to your computer and use it in GitHub Desktop.
Get list of ARDOP stations
#!/bin/bash
#This script will download the ardop list to the path set below
#It is intended to be run by cron daily
#to keep the list current. km4ack 20181214
#Hint: create a cron job that reads
#30 23 * * * /usr/local/bin/getardoplist
#This script is provided AS IS
#Feel free to mod for your use
#path where files are located
#must match path in findardop script
MYPATH=~/Documents/ardop-list/
#make directory if it doesn't exist
mkdir -p $MYPATH
#set variables for each list
FILE=$MYPATH'ardoplist.txt'
EIGHTY=$MYPATH'80mardoplist.txt'
FORTY=$MYPATH'40mardoplist.txt'
TWENTY=$MYPATH'20mardoplist.txt'
THIRTY=$MYPATH'30mardoplist.txt'
#check internet connection
echo "Please wait while we check your internet connection"
echo "This may take up to a minute"
wget -q --tries=5 --timeout=10 --spider http://google.com
if [[ $? -eq 0 ]]; then
echo
echo "Connection Detected"
echo
echo "Please wait while files are download"
echo "This may take several minutes"
echo "Depending on your internet speed"
else
echo "YOU ARE NOT CONNECTED TO THE INTERNET"
exit
fi
#remove old files before downloading new ones
if [ -f $THIRTY ]; then
rm $THIRTY
fi
if [ -f $FILE ]; then
rm $FILE
fi
if [ -f $EIGHTY ]; then
rm $EIGHTY
fi
if [ -f $FORTY ]; then
rm $FORTY
fi
if [ -f $TWENTY ]; then
rm $TWENTY
fi
#put date on top line of each file
echo "List Last Downloaded $(date)" >> $FILE
echo "List Last Downloaded $(date)" >> $FORTY
echo "List Last Downloaded $(date)" >> $EIGHTY
echo "List Last Downloaded $(date)" >> $TWENTY
echo "List Last Downloaded $(date)" >> $THIRTY
#download list to individual files.
pat rmslist --mode ardop --force-download >> $FILE
pat rmslist --band 80m --mode ardop --force-download >> $EIGHTY
pat rmslist --band 40m --mode ardop --force-download >> $FORTY
pat rmslist --band 20m --mode ardop --force-download >> $TWENTY
pat rmslist --band 30m --mode ardop --force-download >> $THIRTY
echo
echo All lists successfully downloaded
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment