new qndtmf.sh and reflist.sh

pull/3/head
Tom Early 8 years ago
parent acdcef542e
commit cb36c9eda2

@ -4,17 +4,14 @@
# Copyright (C) 2018 by Thomas A. Early N7TAE # Copyright (C) 2018 by Thomas A. Early N7TAE
# #
# This script finds files in the /tmp directory # 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 # The files have a name like x_mod_DTMF_NOTIFY, where x is one of A B or C, the local module
# 0=A module,
# 1=B module,
# 2=C module
# The contents of these files can be as follows: # The contents of these files can be as follows:
# Example: 73 will unlink local module # Example: # will unlink local module
# Example: #75703 will link local module to XRF757 C # Example: B75703 will link local module to XRF757 C
# Example: D00617 will link local module to DCS006 Q # Example: D00617 will link local module to DCS006 Q
# Example: *00101 will link local module to REF001 C # Example: *00103 will link local module to REF001 C
# Example: 99 will report status of the link # Example: 0 or 00 will report status of the link
# We set this to spaces, it will be set later # We set this to spaces, it will be set later
LUSER=" " LUSER=" "
@ -22,124 +19,115 @@ LUSER=" "
cd /tmp cd /tmp
echo started at `date` echo started at `date`
while [ 1 ] while [[ 1 ]]
do do
for i in `ls ?_mod_DTMF_NOTIFY 2>/dev/null` for i in `ls ?_mod_DTMF_NOTIFY 2>/dev/null`
do do
echo found file $i at `date` echo found file $i at `date`
x=${i:0:1} LOCAL_BAND=${i:0:1}
if [ "$x" = "0" ] ; then if [[ "$x" != "A" ]] & [[ "$x" != "B" ]] && [[ "$x" != "C" ]] ; then
LOCAL_BAND=A echo garbage value for local band
elif [ "$x" = "1" ] ; then else
LOCAL_BAND=B CMD=`head -n 1 $i 2>/dev/null`
elif [ "$x" = "2" ] ; then LUSER=`tail -n 1 $i 2>/dev/null`
LOCAL_BAND=C echo "... with these contents: " $CMD " " $LUSER
else if [[ "$CMD" = "#" ]] ; then
LOCAL_BAND=garbage echo Unlinking local band $LOCAL_BAND requested by $LUSER
fi 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" ]] if [[ "$REMOTE_BAND" = "01" ]] ; then
then REMOTE_BAND=A
echo garbage value for local band elif [[ "$REMOTE_BAND" = "02" ]] ; then
else REMOTE_BAND=B
CMD=`head -n 1 $i 2>/dev/null` elif [[ "$REMOTE_BAND" = "03" ]] ; then
LUSER=`tail -n 1 $i 2>/dev/null` REMOTE_BAND=C
echo "... with these contents: " $CMD " " $LUSER elif [[ "$REMOTE_BAND" = "04" ]] ; then
if [ "$CMD" = "73" ] ; then REMOTE_BAND=D
echo Unlinking local band $LOCAL_BAND requested by $LUSER elif [[ "$REMOTE_BAND" = "05" ]] ; then
qnremote ${LOCAL_BAND} "$LUSER" U >/dev/null 2>&1 REMOTE_BAND=E
echo elif [[ "$REMOTE_BAND" = "06" ]] ; then
elif [ "$CMD" = "99" ] ; then REMOTE_BAND=F
echo Link Status on local band $LOCAL_BAND requested by $LUSER elif [[ "$REMOTE_BAND" = "07" ]] ; then
qnremote ${LOCAL_BAND} "$LUSER" I >/dev/null 2>&1 REMOTE_BAND=G
echo elif [[ "$REMOTE_BAND" = "08" ]] ; then
else REMOTE_BAND=H
LEN=${#CMD} elif [[ "$REMOTE_BAND" = "09" ]] ; then
if [ "$LEN" = "6" ] ; then REMOTE_BAND=I
PFX=${CMD:0:1} elif [[ "$REMOTE_BAND" = "10" ]] ; then
REMOTE_NODE=${CMD:1:3} REMOTE_BAND=J
REMOTE_BAND=${CMD:4:2} 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 if [[ "$PFX" = "B" ]] ; then
REMOTE_BAND=A RMT=XRF
elif [ "$REMOTE_BAND" = "02" ] ; then elif [[ "$PFX" = "D" ]] ; then
REMOTE_BAND=B RMT=DCS
elif [ "$REMOTE_BAND" = "03" ] ; then elif [[ "$PFX" = "*" ]] ; then
REMOTE_BAND=C RMT=REF
elif [ "$REMOTE_BAND" = "04" ] ; then else
REMOTE_BAND=D RMT=garbage
elif [ "$REMOTE_BAND" = "05" ] ; then fi
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" = "#" ] ; then if [[ "$RMT" == "garbage" ]] ; then
RMT=XRF echo garbage value in prefix
elif [ "$PFX" = "D" ] ; then else
RMT=DCS echo linking local band $LOCAL_BAND to remote node ${RMT}${REMOTE_NODE} $REMOTE_BAND requested by $LUSER
elif [ "$PFX" = "*" ] ; then qnremote ${LOCAL_BAND} "$LUSER" ${RMT}${REMOTE_NODE}${REMOTE_BAND}L >/dev/null 2>&1
RMT=REF echo
else fi
RMT=garbage fi
fi fi
fi
if [[ "$RMT" == "garbage" ]] rm -f $i
then done
echo garbage value in prefix sleep 3
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 done
exit 0 exit 0

@ -1,29 +1,14 @@
#/bin/bash #!/bin/bash
# Get the big list from Ramesh (VA3UV) and extract the DCS, DStar and XReflectors only. wget ftp://dschost1.w6kd.com/DExtra_Hosts.txt || wget ftp://dschost2.w6kd.com/DExtra_Hosts.txt
# Put XREF reflectors on port 20001 so they will use DPlus linking! 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
# 73
#
# Tom, n7tae (at) arrl (dot) net
if [ -e gwys.txt ]; then /bin/rm -f gwys.txt
mv -f gwys.txt gwys.txt.orig
fi
rm -f gwys.va2uv.txt echo "# Downloaded from dschost1.w6kd.com `date`" > gwys.txt
awk '$1 ~ /^REF/ { printf "%s %s 20001\n", $1, $2 }' DPlus_Hosts.txt >> gwys.txt
wget -nv -O gwys.va3uv.txt http://www.va3uv.com/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
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
/bin/rm -f D{Extra,Plus,DSC}_Hosts.txt

Loading…
Cancel
Save

Powered by TurnKey Linux.