1
0
mirror of https://github.com/AG7GN/nexus-utilities.git synced 2025-05-20 08:20:11 -07:00

Added ability to capture Direwolf output via socat

This commit is contained in:
Steve Magnuson 2021-03-22 16:14:33 -07:00
parent 1e54c2529d
commit c8035d5560
2 changed files with 12 additions and 5 deletions

View File

@ -11,6 +11,13 @@ This script allows you to run Direwolf as an APRS digipeater (full or fill-in) a
<p> <p>
See Direwolf author WB2OSZ's <a href="https://github.com/wb2osz/direwolf/blob/master/doc/Successful-APRS-IGate-Operation.pdf">Successful APRS IGate Operation</a> for some good tips on using APRS. See Direwolf author WB2OSZ's <a href="https://github.com/wb2osz/direwolf/blob/master/doc/Successful-APRS-IGate-Operation.pdf">Successful APRS IGate Operation</a> for some good tips on using APRS.
</p> </p>
<p>
Note that you can use the output text (everything that appears in the Monitor window) in your own script by incorporating this command into your script:
</p>
<pre>socat udp-recv:3333,reuseaddr -</pre>
<p>
That command will monitor UDP port 3333, the port to which the main script writes its data, to STDOUT so you can capture the data and manipulate it as needed.
</p>
<a href="#monitor">Open monitor window when [re]starting this script</a><br /> <a href="#monitor">Open monitor window when [re]starting this script</a><br />
<a href="#call">Call sign and SSID</a><br /> <a href="#call">Call sign and SSID</a><br />

View File

@ -16,7 +16,7 @@
#% #%
#================================================================ #================================================================
#- IMPLEMENTATION #- IMPLEMENTATION
#- version ${SCRIPT_NAME} 2.1.2 #- version ${SCRIPT_NAME} 2.1.3
#- author Steve Magnuson, AG7GN #- author Steve Magnuson, AG7GN
#- license CC-BY-SA Creative Commons License #- license CC-BY-SA Creative Commons License
#- script_id 0 #- script_id 0
@ -616,8 +616,8 @@ do
if [[ ${F[_MONITOR_]} == "TRUE" ]] if [[ ${F[_MONITOR_]} == "TRUE" ]]
then then
MONITOR_TITLE="APRS $MODE_MESSAGE Monitor" MONITOR_TITLE="APRS $MODE_MESSAGE Monitor"
lxterminal --geometry=80x30 -t "$MONITOR_TITLE" -e "socat udp-recv:$SOCAT_PORT -" & lxterminal --geometry=80x30 -t "$MONITOR_TITLE" -e "socat udp-recv:$SOCAT_PORT,reuseaddr -" &
echo -e "" | socat - udp-datagram:localhost:$SOCAT_PORT echo -e "" | socat - udp-sendto:127.255.255.255:$SOCAT_PORT,broadcast
# Set background color of lxterminal if necessary # Set background color of lxterminal if necessary
#if [[ ${F[_COLORS_]} == 0 ]] #if [[ ${F[_COLORS_]} == 0 ]]
#then #then
@ -627,9 +627,9 @@ do
#fi #fi
fi fi
# Send direwolf output to the terminal we opened earlier # Send direwolf output to the terminal we opened earlier
($DIREWOLF -t ${F[_COLORS_]} -c $DW_CONFIG 2>&6 | socat - udp-datagram:localhost:$SOCAT_PORT) & ($DIREWOLF -t ${F[_COLORS_]} -c $DW_CONFIG 2>&6 | socat - udp-sendto:127.255.255.255:$SOCAT_PORT,broadcast) &
direwolf_PID=$(pgrep -f "^$DIREWOLF -t ${F[_COLORS_]} -c $DW_CONFIG") direwolf_PID=$(pgrep -f "^$DIREWOLF -t ${F[_COLORS_]} -c $DW_CONFIG")
socat_PID=$(pgrep -f "socat udp-recv:$SOCAT_PORT -") socat_PID=$(pgrep -f "socat udp-recv:$SOCAT_PORT,reuseaddr -")
if [[ $direwolf_PID == "" ]] if [[ $direwolf_PID == "" ]]
then then
echo -e "\nDirewolf was *NOT* started" >&6 echo -e "\nDirewolf was *NOT* started" >&6