shell-script aprs_status.sh - alle 30min via /etc/crontab.
Aufgepasst: krumme Uhrzeit wählen, damit man nicht findu.com DOS't.
Das Script schreibt die Daten über TCP/IP von dk0bln nach db0blo. Auf db0blo UDP Port 7779 hört ein Script das die Daten entgegennimmt und dem Funkrufmaster-Programm zuspielt. Man kann, wenn es auf dem selben System läuft wie frmaster, die Daten auch direkt in frmaster's import-Verzeichnis stellen. S. z.B. wxtx script.
aprs_status.sh:
#!/bin/sh # (c) 2009 - Thomas Osterried DL9SAU. License: GPL. REMOTE_IP=44.130.39.100 PORT=7779 MYLATLON="lat=52.512&lon=13.3800" # Berlin, Brandenburger Tor # 1 2 3 4 # Slot 5-10: APRS Userin Berlin. Dist/km to BB-Tor. Dir/NSWO.Time/Z. Last 12h. do_parse() { CALL="" DIST="" DIR="" T="" new_user=0 while true; do read -r line || return echo "$line" | fgrep '.GIF]' >/dev/null if [ $? -eq 0 ]; then # Filter # EL GW WX Rel BBS DigiDigi echo "$line" | egrep '(S17|S07|P64|P83|P35|S04|P04).GIF' >/dev/null if [ $? -gt 0 ]; then CALL=$(echo "$line" | awk '{print $2}') else CALL="" fi DIST="" DIR="" T="" else # just 4 sure if [ "$CALL" = "" ]; then continue; fi echo "$line" | grep " ..:..:..:..$" >/dev/null if [ $? -gt 0 ]; then continue; fi # our time computation only represents the last 24h and do not display "-1d", "-2d", .. echo "$line" | grep " 00:..:..:..$" >/dev/null if [ $? -gt 0 ]; then CALL=""; DIR="", DIST="", T=""; continue; fi TDIFF=$( echo "$line" | rev | awk '{print $1}' | rev | sed -e 's/:/*60*60*24+/' | sed -e 's/:/*60*60+/' | sed -e 's/:/*60+/' | tr -d ':' | bc) T=$(echo "import time; print time.strftime('%H%M', time.gmtime(time.time()-$TDIFF))" | python) DIR=$(echo "$line" | rev | awk '{print $2}' | rev) DIST=$(echo "$line" | rev | awk '{print $3}' | rev) DIST=$(echo "$DIST * 1.6" | bc |sed -e 's/^\./0./') if [ "$CALL" != "" -a "$DIST" != "" -a "$DIR" != "" -a "$T" != "" ]; then # flush previous user's data printf "%-9.9s%4.4s%-2.2s %-4.4s\n" "$CALL" "$DIST" "$DIR" "$T" fi fi done } # ----------------------------------------------------------------------------- # main() lynx --dump "http://www.findu.com/cgi-bin/near.cgi?${MYLATLON}&last=12&distance=30" | grep -A 1000 'Call callbook msg wx lat lon distance direction Last Position' |grep -B 1000 'Overall rate: '|grep -v 'Call callbook msg wx lat lon distance direction Last Position' | grep -v 'Overall rate: ' | do_parse | { slot=5 line_num=0 msg="" while true; do read line || break if [ $line_num -eq 3 ] ; then echo "rubrik APRS $slot $msg$line" msg="" line_num=0 slot=$(($slot + 1)) if [ $slot -eq 11 ]; then break; fi else msg="$msg$line" line_num=$(($line_num + 1)) fi done if [ "$msg" != "" ]; then echo "rubrik APRS $slot $msg" slot=$(($slot + 1)) fi while [ $slot -lt 11 ]; do echo "rubrik APRS $slot -" slot=$(($slot + 1)) done } | nc -u -q1 $REMOTE_IP $PORT