From cb36c9eda22f1270ddcc882b9e9f7780d566fa45 Mon Sep 17 00:00:00 2001 From: Tom Early Date: Tue, 24 Apr 2018 17:31:05 -0700 Subject: [PATCH] new qndtmf.sh and reflist.sh --- qndtmf.sh | 232 +++++++++++++++++++++++++---------------------------- reflist.sh | 35 +++----- 2 files changed, 120 insertions(+), 147 deletions(-) diff --git a/qndtmf.sh b/qndtmf.sh index 64932b9..cce2194 100755 --- a/qndtmf.sh +++ b/qndtmf.sh @@ -4,17 +4,14 @@ # Copyright (C) 2018 by Thomas A. Early N7TAE # # This script finds files in the /tmp directory -# The files have a name like x_mod_DTMF_NOTIFY, where x is one of 0 1 2 -# 0=A module, -# 1=B module, -# 2=C module +# The files have a name like x_mod_DTMF_NOTIFY, where x is one of A B or C, the local module # The contents of these files can be as follows: -# Example: 73 will unlink local module -# Example: #75703 will link local module to XRF757 C +# Example: # will unlink local module +# Example: B75703 will link local module to XRF757 C # Example: D00617 will link local module to DCS006 Q -# Example: *00101 will link local module to REF001 C -# Example: 99 will report status of the link +# Example: *00103 will link local module to REF001 C +# Example: 0 or 00 will report status of the link # We set this to spaces, it will be set later LUSER=" " @@ -22,124 +19,115 @@ LUSER=" " cd /tmp echo started at `date` -while [ 1 ] +while [[ 1 ]] do - for i in `ls ?_mod_DTMF_NOTIFY 2>/dev/null` - do - echo found file $i at `date` - x=${i:0:1} - if [ "$x" = "0" ] ; then - LOCAL_BAND=A - elif [ "$x" = "1" ] ; then - LOCAL_BAND=B - elif [ "$x" = "2" ] ; then - LOCAL_BAND=C - else - LOCAL_BAND=garbage - fi + for i in `ls ?_mod_DTMF_NOTIFY 2>/dev/null` + do + echo found file $i at `date` + LOCAL_BAND=${i:0:1} + if [[ "$x" != "A" ]] & [[ "$x" != "B" ]] && [[ "$x" != "C" ]] ; then + echo garbage value for local band + else + CMD=`head -n 1 $i 2>/dev/null` + LUSER=`tail -n 1 $i 2>/dev/null` + echo "... with these contents: " $CMD " " $LUSER + if [[ "$CMD" = "#" ]] ; then + echo Unlinking local band $LOCAL_BAND requested by $LUSER + qnremote ${LOCAL_BAND} "$LUSER" U >/dev/null 2>&1 + echo + elif [[ "$CMD" = "0" ]] || [[ "$CMD" = "00" ]] ; then + echo Link Status on local band $LOCAL_BAND requested by $LUSER + qnremote ${LOCAL_BAND} "$LUSER" I >/dev/null 2>&1 + echo + elif [[ "$CMD" = "**" ]] ; then + echo Load Hosts on local band $LOCAL_BAND requested by $LUSER + qnremote ${LOCAL_BAND} "$LUSER" L >/dev/null 2>&1 + else + LEN=${#CMD} + if [[ "$LEN" = "6" ]] ; then + PFX=${CMD:0:1} + REMOTE_NODE=${CMD:1:3} + REMOTE_BAND=${CMD:4:2} - if [[ "$LOCAL_BAND" == "garbage" ]] - then - echo garbage value for local band - else - CMD=`head -n 1 $i 2>/dev/null` - LUSER=`tail -n 1 $i 2>/dev/null` - echo "... with these contents: " $CMD " " $LUSER - if [ "$CMD" = "73" ] ; then - echo Unlinking local band $LOCAL_BAND requested by $LUSER - qnremote ${LOCAL_BAND} "$LUSER" U >/dev/null 2>&1 - echo - elif [ "$CMD" = "99" ] ; then - echo Link Status on local band $LOCAL_BAND requested by $LUSER - qnremote ${LOCAL_BAND} "$LUSER" I >/dev/null 2>&1 - echo - else - LEN=${#CMD} - if [ "$LEN" = "6" ] ; then - PFX=${CMD:0:1} - REMOTE_NODE=${CMD:1:3} - REMOTE_BAND=${CMD:4:2} + if [[ "$REMOTE_BAND" = "01" ]] ; then + REMOTE_BAND=A + elif [[ "$REMOTE_BAND" = "02" ]] ; then + REMOTE_BAND=B + elif [[ "$REMOTE_BAND" = "03" ]] ; then + REMOTE_BAND=C + elif [[ "$REMOTE_BAND" = "04" ]] ; then + REMOTE_BAND=D + elif [[ "$REMOTE_BAND" = "05" ]] ; then + REMOTE_BAND=E + elif [[ "$REMOTE_BAND" = "06" ]] ; then + REMOTE_BAND=F + elif [[ "$REMOTE_BAND" = "07" ]] ; then + REMOTE_BAND=G + elif [[ "$REMOTE_BAND" = "08" ]] ; then + REMOTE_BAND=H + elif [[ "$REMOTE_BAND" = "09" ]] ; then + REMOTE_BAND=I + elif [[ "$REMOTE_BAND" = "10" ]] ; then + REMOTE_BAND=J + elif [[ "$REMOTE_BAND" = "11" ]] ; then + REMOTE_BAND=K + elif [[ "$REMOTE_BAND" = "12" ]] ; then + REMOTE_BAND=L + elif [[ "$REMOTE_BAND" = "13" ]] ; then + REMOTE_BAND=M + elif [[ "$REMOTE_BAND" = "14" ]] ; then + REMOTE_BAND=N + elif [[ "$REMOTE_BAND" = "15" ]] ; then + REMOTE_BAND=O + elif [[ "$REMOTE_BAND" = "16" ]] ; then + REMOTE_BAND=P + elif [[ "$REMOTE_BAND" = "17" ]] ; then + REMOTE_BAND=Q + elif [[ "$REMOTE_BAND" = "18" ]] ; then + REMOTE_BAND=R + elif [[ "$REMOTE_BAND" = "19" ]] ; then + REMOTE_BAND=S + elif [[ "$REMOTE_BAND" = "20" ]] ; then + REMOTE_BAND=T + elif [[ "$REMOTE_BAND" = "21" ]] ; then + REMOTE_BAND=U + elif [[ "$REMOTE_BAND" = "22" ]] ; then + REMOTE_BAND=V + elif [[ "$REMOTE_BAND" = "23" ]] ; then + REMOTE_BAND=W + elif [[ "$REMOTE_BAND" = "24" ]] ; then + REMOTE_BAND=X + elif [[ "$REMOTE_BAND" = "25" ]] ; then + REMOTE_BAND=Y + elif [[ "$REMOTE_BAND" = "26" ]] ; then + REMOTE_BAND=Z + else + REMOTE_BAND=Z + fi - if [ "$REMOTE_BAND" = "01" ] ; then - REMOTE_BAND=A - elif [ "$REMOTE_BAND" = "02" ] ; then - REMOTE_BAND=B - elif [ "$REMOTE_BAND" = "03" ] ; then - REMOTE_BAND=C - elif [ "$REMOTE_BAND" = "04" ] ; then - REMOTE_BAND=D - elif [ "$REMOTE_BAND" = "05" ] ; then - REMOTE_BAND=E - elif [ "$REMOTE_BAND" = "06" ] ; then - REMOTE_BAND=F - elif [ "$REMOTE_BAND" = "07" ] ; then - REMOTE_BAND=G - elif [ "$REMOTE_BAND" = "08" ] ; then - REMOTE_BAND=H - elif [ "$REMOTE_BAND" = "09" ] ; then - REMOTE_BAND=I - elif [ "$REMOTE_BAND" = "10" ] ; then - REMOTE_BAND=J - elif [ "$REMOTE_BAND" = "11" ] ; then - REMOTE_BAND=K - elif [ "$REMOTE_BAND" = "12" ] ; then - REMOTE_BAND=L - elif [ "$REMOTE_BAND" = "13" ] ; then - REMOTE_BAND=M - elif [ "$REMOTE_BAND" = "14" ] ; then - REMOTE_BAND=N - elif [ "$REMOTE_BAND" = "15" ] ; then - REMOTE_BAND=O - elif [ "$REMOTE_BAND" = "16" ] ; then - REMOTE_BAND=P - elif [ "$REMOTE_BAND" = "17" ] ; then - REMOTE_BAND=Q - elif [ "$REMOTE_BAND" = "18" ] ; then - REMOTE_BAND=R - elif [ "$REMOTE_BAND" = "19" ] ; then - REMOTE_BAND=S - elif [ "$REMOTE_BAND" = "20" ] ; then - REMOTE_BAND=T - elif [ "$REMOTE_BAND" = "21" ] ; then - REMOTE_BAND=U - elif [ "$REMOTE_BAND" = "22" ] ; then - REMOTE_BAND=V - elif [ "$REMOTE_BAND" = "23" ] ; then - REMOTE_BAND=W - elif [ "$REMOTE_BAND" = "24" ] ; then - REMOTE_BAND=X - elif [ "$REMOTE_BAND" = "25" ] ; then - REMOTE_BAND=Y - elif [ "$REMOTE_BAND" = "26" ] ; then - REMOTE_BAND=Z - else - REMOTE_BAND=Z - fi + if [[ "$PFX" = "B" ]] ; then + RMT=XRF + elif [[ "$PFX" = "D" ]] ; then + RMT=DCS + elif [[ "$PFX" = "*" ]] ; then + RMT=REF + else + RMT=garbage + fi - if [ "$PFX" = "#" ] ; then - RMT=XRF - elif [ "$PFX" = "D" ] ; then - RMT=DCS - elif [ "$PFX" = "*" ] ; then - RMT=REF - else - RMT=garbage - fi - - if [[ "$RMT" == "garbage" ]] - then - echo garbage value in prefix - else - echo linking local band $LOCAL_BAND to remote node ${RMT}${REMOTE_NODE} $REMOTE_BAND requested by $LUSER - qnremote ${LOCAL_BAND} "$LUSER" ${RMT}${REMOTE_NODE}${REMOTE_BAND}L >/dev/null 2>&1 - echo - fi - fi - fi - fi - rm -f $i - done - sleep 3 + if [[ "$RMT" == "garbage" ]] ; then + echo garbage value in prefix + else + echo linking local band $LOCAL_BAND to remote node ${RMT}${REMOTE_NODE} $REMOTE_BAND requested by $LUSER + qnremote ${LOCAL_BAND} "$LUSER" ${RMT}${REMOTE_NODE}${REMOTE_BAND}L >/dev/null 2>&1 + echo + fi + fi + fi + fi + rm -f $i + done + sleep 3 done exit 0 diff --git a/reflist.sh b/reflist.sh index 65946f8..aa50572 100755 --- a/reflist.sh +++ b/reflist.sh @@ -1,29 +1,14 @@ -#/bin/bash +#!/bin/bash -# Get the big list from Ramesh (VA3UV) and extract the DCS, DStar and XReflectors only. -# Put XREF reflectors on port 20001 so they will use DPlus linking! -# -# 73 -# -# Tom, n7tae (at) arrl (dot) net +wget ftp://dschost1.w6kd.com/DExtra_Hosts.txt || wget ftp://dschost2.w6kd.com/DExtra_Hosts.txt +wget ftp://dschost1.w6kd.com/DPlus_Hosts.txt || wget ftp://dschost2.w6kd.com/DPlus_Hosts.txt +wget ftp://dschost1.w6kd.com/DCS_Hosts.txt || wget ftp://dschost2.w6kd.com/DCS_Hosts.txt -if [ -e gwys.txt ]; then - mv -f gwys.txt gwys.txt.orig -fi +/bin/rm -f gwys.txt -rm -f gwys.va2uv.txt - -wget -nv -O gwys.va3uv.txt http://www.va3uv.com/gwys.txt - -if [ -e gwys.va3uv.txt ]; then - echo "# from www.va3uv.com on `date`" > gwys.txt - echo "Got `awk '$1~/^REF/{print $1, $2, $3}' gwys.va3uv.txt | tee -a gwys.txt | wc -l` REF reflectors" - echo "Got `awk '$1~/^XRF/{print $1, $2, $3}' gwys.va3uv.txt | tee -a gwys.txt | wc -l` XRF reflectors" - echo "Got `awk '$1~/^DCS/{print $1, $2, $3}' gwys.va3uv.txt | tee -a gwys.txt | wc -l` DCS reflectors" -else - echo "Could not get gateways list from www.va3uv.com!" - if [ -e gwys.txt.orig ]; then - mv -f gwys.txt.orig gwys.txt - fi -fi +echo "# Downloaded from dschost1.w6kd.com `date`" > gwys.txt +awk '$1 ~ /^REF/ { printf "%s %s 20001\n", $1, $2 }' DPlus_Hosts.txt >> gwys.txt +awk '$1 ~ /^XRF/ { printf "%s %s 30001\n", $1, $2 }' DExtra_Hosts.txt >> gwys.txt +awk '$1 ~ /^DCS/ { printf "%s %s 30051\n", $1, $2 }' DCS_Hosts.txt >> gwys.txt +/bin/rm -f D{Extra,Plus,DSC}_Hosts.txt