diff --git a/dw_aprs_gui.sh b/dw_aprs_gui.sh index b29d93a..b4690b4 100755 --- a/dw_aprs_gui.sh +++ b/dw_aprs_gui.sh @@ -16,7 +16,7 @@ #% #================================================================ #- IMPLEMENTATION -#- version ${SCRIPT_NAME} 1.0.6 +#- version ${SCRIPT_NAME} 1.0.7 #- author Steve Magnuson, AG7GN #- license CC-BY-SA Creative Commons License #- script_id 0 @@ -46,7 +46,7 @@ Optnum=$# function TrapCleanup() { [[ -d "${TMPDIR}" ]] && rm -rf "${TMPDIR}/" #pkill "^direwolf" - #kill $timeStamp_PID >/dev/null 2>&1 + kill $clearTextInfo_PID >/dev/null 2>&1 kill $direwolf_PID >/dev/null 2>&1 for P in ${YAD_PIDs[@]} do @@ -301,22 +301,26 @@ EOF } -#function timeStamp () { -# exec 6<> $PIPEDATA -# while sleep 60 -# do -# echo -e "\nTIMESTAMP: $(date)" -# done >&6 -#} +function clearTextInfo () { + # Arguments: $1 = sleep time. + # Send FormFeed character every $1 minutes to clear yad text-info + local TIMER=$1 + while sleep $TIMER + do + #echo -e "\nTIMESTAMP: $(date)" + echo -e "\f" + echo "$(date) Cleared monitor window. Window is cleared every $TIMER." + done >$PIPEDATA +} function killDirewolf () { # $1 is the direwolf PID if pgrep ^direwolf | grep -q $1 2>/dev/null then kill $1 >/dev/null 2>&1 - echo -e "\n\nDirewolf stopped. Click \"Restart...\" button below to restart." >&6 + echo -e "\n\nDirewolf stopped. Click \"Restart...\" button below to restart." >$PIPEDATA else - echo -e "\n\nDirewolf was already stopped. Click \"Restart...\" button below to restart." >&6 + echo -e "\n\nDirewolf was already stopped. Click \"Restart...\" button below to restart." >$PIPEDATA fi } @@ -454,7 +458,7 @@ fi export -f setDefaults loadAPRSDefaults killDirewolf export load_aprs_defaults_cmd='@bash -c "setDefaults; loadAPRSDefaults"' export click_aprs_help_cmd='bash -c "xdg-open /usr/local/share/hampi/aprs_help.html"' -#export PIPEDATA=$PIPE +export PIPEDATA=$PIPE #============================ # MAIN SCRIPT @@ -471,7 +475,7 @@ $SYNTAX && set -n # Run in debug mode, if set $DEBUG && set -x -timeStamp_PID="" +clearTextInfo_PID="" direwolf_PID="" YAD_PIDs=() @@ -482,12 +486,12 @@ do #DIREWOLF="$(command -v direwolf) -p -t 0 -d u" # No pty # Direwolf does not allow embedded spaces in timestamp format string -T - DIREWOLF="$(command -v direwolf) -t 0 -d u -T "%Y/%m/%d_%H:%M:%S"" + DIREWOLF="$(command -v direwolf) -t 0 -d u -T "%Y%m%dT%H:%M:%S"" # Kill any running processes and load latest settings killDirewolf $direwolf_PID -# for P in ${YAD_PIDs[@]} $timeStamp_PID - for P in ${YAD_PIDs[@]} +# for P in ${YAD_PIDs[@]} $clearTextInfo_PID + for P in $clearTextInfo_PID ${YAD_PIDs[@]} do ps x | egrep -q "^$P" && kill $P done @@ -497,19 +501,20 @@ do loadSettings $CONFIG_FILE YAD_PIDs=() - # Start the monitor tab + # Start the monitor tab [[ $FIRST_RUN == true ]] && MODE_MESSAGE="" || MODE_MESSAGE="${F[_APRSMODE_]}" TEXT="Direwolf $MODE_MESSAGE APRS Monitor" - yad --plug="$ID" --tabnum=1 --text="$TEXT" --show-uri --show-cursor \ - --back=black --fore=yellow \ + yad --plug="$ID" --tabnum=1 --text="$TEXT" --back=black --fore=yellow \ --text-info --text-align=center \ - --tail --center <&6 & + --tail --listen --center <&6 & + #MONITOR_YAD_PID=$! + #YAD_PIDs+=( $MONITOR_YAD_PID ) YAD_PIDs+=( $! ) + #tail -F --pid=$MONITOR_YAD_PID -q -n 30 $LOGFILE 2>/dev/null | cat -v >&6 & - # Start the Time Stamper function - #timeStamp & - #timeStamp_PID=$! - + clearTextInfo 15m & + clearTextInfo_PID=$! + if [[ $FIRST_RUN == true ]] then echo -e "\n\nDirewolf was not started because APRS is not configured.\nConfigure it in the \"Configure APRS\" tab, then click the \"Restart...\" button below." >&6 @@ -519,7 +524,7 @@ do cat $DW_CONFIG | grep -v "^$" >&6 echo >&6 [[ ${F[_AUDIOSTATS_]} == 0 ]] || DIREWOLF+=" -a ${F[_AUDIOSTATS_]}" - $DIREWOLF -c $DW_CONFIG >&6 2>&6 & + $DIREWOLF -c $DW_CONFIG >&6 2>&1 & direwolf_PID=$! echo -e "\n\nDirewolf APRS has started. PID=$direwolf_PID" >&6 fi @@ -606,17 +611,18 @@ do # Save the previous piano script autostart setting PREVIOUS_AUTOSTART="${F[_BOOTSTART_]}" - # Set up a notebook with the 3 tabs. + # Set up a notebook with the 2 tabs. #yad --title="$TITLE" --text="Direwolf APRS Monitor and Configuration" \ yad --title="$TITLE" \ - --text-align="center" --notebook --key="$ID" \ + --text-align="center" --notebook --key="$ID" --window-icon=logviewer \ --posx=10 --posy=45 --width=1100 --height=700 \ --buttons-layout=center \ --tab="Monitor APRS" \ --tab="Configure APRS" \ --button="Stop Direwolf APRS & Exit":1 \ --button="Stop Direwolf APRS":"bash -c 'killDirewolf $direwolf_PID'" \ - --button="Restart Direwolf APRS":0 + --button="Restart Direwolf APRS":0 + RETURN_CODE=$? case $RETURN_CODE in diff --git a/dw_pat_gui.sh b/dw_pat_gui.sh index c2e8365..3e5cd51 100755 --- a/dw_pat_gui.sh +++ b/dw_pat_gui.sh @@ -15,7 +15,7 @@ #% #================================================================ #- IMPLEMENTATION -#- version ${SCRIPT_NAME} 1.6.7 +#- version ${SCRIPT_NAME} 1.6.9 #- author Steve Magnuson, AG7GN #- license CC-BY-SA Creative Commons License #- script_id 0 @@ -50,7 +50,7 @@ Optnum=$# function TrapCleanup() { [[ -d "${TMPDIR}" ]] && rm -rf "${TMPDIR}/" - #kill $timeStamp_PID >/dev/null 2>&1 + kill $clearTextInfo_PID >/dev/null 2>&1 kill $direwolf_PID >/dev/null 2>&1 kill $pat_PID >/dev/null 2>&1 kill $RIG_PID >/dev/null 2>&1 @@ -208,21 +208,26 @@ EOF PAT_LOCATOR="$(jq -r ".locator" $PAT_CONFIG)" } -#function timeStamp () { -# while sleep 60 -# do -# echo -e "\nTIMESTAMP: $(date)" -# done >$PIPEDATA -#} +function clearTextInfo () { + # Arguments: $1 = sleep time. + # Send FormFeed character every $1 minutes to clear yad text-info + local TIMER=$1 + while sleep $TIMER + do + #echo -e "\nTIMESTAMP: $(date)" + echo -e "\f" + echo "$(date) Cleared monitor window. Window is cleared every $TIMER." + done >$PIPEDATA +} function killDirewolf () { # $1 is the direwolf PID if pgrep ^direwolf | grep -q $1 2>/dev/null then kill $1 >/dev/null 2>&1 - echo -e "\n\nDirewolf stopped. Click \"Save Settings...\" button below to restart." >&3 + echo -e "\n\nDirewolf stopped. Click \"Save Settings...\" button below to restart." >$PIPEDATA else - echo -e "\n\nDirewolf was already stopped. Click \"Save Settings...\" button below to restart." >&3 + echo -e "\n\nDirewolf was already stopped. Click \"Save Settings...\" button below to restart." >$PIPEDATA fi } @@ -269,7 +274,7 @@ PAT_CONFIG="$HOME/.wl2k/config.json" RETURN_CODE=0 # Direwolf does not allow embedded spaces in timestamp format string -T -DIREWOLF="$(command -v direwolf) -p -t 0 -d u -T "%Y/%m/%d_%H:%M:%S"" +DIREWOLF="$(command -v direwolf) -p -t 0 -d u -T "%Y%m%d_%H:%M:%S"" #PAT="$(command -v pat) --log /dev/stdout -l ax25,telnet http" PAT="$(command -v pat) -l ax25,telnet http" @@ -388,7 +393,7 @@ cat $PAT_CONFIG | jq --arg R "network" '.ax25.rig = $R' | sponge $PAT_CONFIG export -f setTNCpatDefaults loadpatDefaults export load_pat_defaults_cmd='@bash -c "setTNCpatDefaults; loadpatDefaults"' export click_dw_pat_help_cmd='bash -c "xdg-open /usr/local/share/hampi/dw_pat_gui_help.html"' -#export PIPEDATA=$PIPE +export PIPEDATA=$PIPE #============================ # MAIN SCRIPT @@ -405,8 +410,8 @@ $SYNTAX && set -n # Run in debug mode, if set $DEBUG && set -x -#timeStamp & -#timeStamp_PID=$! +#clearTextInfo & +#clearTextInfo_PID=$! direwolf_PID="" pat_PID="" @@ -417,7 +422,7 @@ do # Kill any running processes and load latest settings killDirewolf $direwolf_PID [[ $pat_PID == "" ]] || kill $pat_PID >/dev/null 2>&1 - for P in ${YAD_PIDs[@]} + for P in $clearTextInfo_PID ${YAD_PIDs[@]} do ps x | egrep -q "^$P" && kill $P done @@ -436,9 +441,12 @@ do yad --plug="$ID" --tabnum=1 \ --back=black --fore=yellow --selectable-labels \ --text-info --text-align=center --text="$TEXT" \ - --tail --center <&3 & + --tail --listen --center <&3 & YAD_PIDs+=( $! ) + clearTextInfo 60m & + clearTextInfo_PID=$! + # Start rigctld. if pgrep rigctld >/dev/null then diff --git a/hampi-utilities.version b/hampi-utilities.version index 7c15412..47df61e 100644 --- a/hampi-utilities.version +++ b/hampi-utilities.version @@ -1 +1 @@ -VERSION="2.3.17" \ No newline at end of file +VERSION="2.3.18" \ No newline at end of file