get data from aprs.fi
This commit is contained in:
parent
683476941d
commit
2c6ffbee87
20
scripts/getwx.sh
Executable file
20
scripts/getwx.sh
Executable file
@ -0,0 +1,20 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
NAMETAG=$1
|
||||||
|
WXNAME=$2
|
||||||
|
WXAPIKEY=$3
|
||||||
|
|
||||||
|
WXAPRS="http://api.aprs.fi/api/get?name=$WXNAME&apikey=$WXAPIKEY&format=xml&what=wx"
|
||||||
|
WXFILE="/tmp/aprs.wx.xml"
|
||||||
|
TIMECASH=$(( 60 * 60 * 5 )) # 5 minut
|
||||||
|
|
||||||
|
|
||||||
|
NOW=$(date -u +%s)
|
||||||
|
LASTTIME=$(xml sel -t -v "/xml/entries/entry/time" $WXFILE )
|
||||||
|
|
||||||
|
if (( $NOW - $TIMECASH > $LASTTIME +1 ))
|
||||||
|
then
|
||||||
|
wget $WXAPRS -O $WXFILE
|
||||||
|
fi
|
||||||
|
|
||||||
|
xml sel -t -v "/xml/entries/entry/$NAMETAG" $WXFILE
|
||||||
Loading…
Reference in New Issue
Block a user