A handy utility shell menu for radiosonde-auto-rx

The article describes a simple but handy utility menu for a RPi installation of radiosonde-auto-rx.

This utility uses a text mode terminal, so access by a SSH terminal session or a terminal windows if running under a GUI.

Above is a screenshot using Putty. The menu contains most things I need to do from time to time in monitoring / configuring / upgrading radiosonde-auto-rx.

This utility uses shmenu. For a RPi, download and install the latest armhf version. (Hint: sudo apt install <package file name>.)

I use a dedicated user radiosonde for radiosonde-auto-rx, and the bulk of radiosonde-auto-rx is installed in subdirectory /home/radiosonde/radiosonde-auto-rx. The files below are installed in the user’s root directory.

Here is the displayed menu file rsmenu.scr.

Radiosonde utility menu
=======================

   1. logs (docker logs --tail 50 radiosonde_auto_rx)

   2. logs --follow (docker logs --tail 50 --follow radiosonde_auto_rx)

   3. restart (docker restart radiosonde_auto_rx)

   4. stop (docker stop radiosonde_auto_rx)

   5. update radiosonde_auto_rx

   6.

   7. mc ~/radiosonde_auto_rx

   8. browse config file (less ~/radiosonde_auto_rx/station.cfg)

   9. edit config file ($EDITOR ~/radiosonde_auto_rx/station.cfg)

 ESC. Quit

Here is the displayed menu file rsmenu which needs execute permission.

#! /bin/bash
scriptname=${0##*/}
scriptdir=${0%/*}

function hetc {
echo -e \\nHit ENTER to continue...
read
}

function ctrl_c() {
:
}

until shmenu 123456789qQ $scriptdir/$scriptname.scr; do
case "$?" in
1) docker logs --tail 50 radiosonde_auto_rx;
hetc;;
2) trap ctrl_c INT;
docker logs --tail 50 --follow radiosonde_auto_rx;
trap - INT;
hetc;;
3) docker restart radiosonde_auto_rx;
hetc;;
4) docker stop radiosonde_auto_rx;
hetc;;
5) #pull latest
docker pull ghcr.io/projecthorus/radiosonde_auto_rx:latest;
#stop
docker stop radiosonde_auto_rx || true;
docker rm radiosonde_auto_rx || true;
docker run -d --name radiosonde_auto_rx --restart="always" --device=/dev/bus/usb --network=host \
  -v ~/radiosonde_auto_rx/station.cfg:/opt/auto_rx/station.cfg:ro \
  -v ~/radiosonde_auto_rx/log/:/opt/auto_rx/log/ ghcr.io/projecthorus/radiosonde_auto_rx:latest;
docker restart radiosonde_auto_rx;
hetc;;
7) mc ~/radiosonde_auto_rx;;
8) less ~/radiosonde_auto_rx/station.cfg;;
9) $EDITOR ~/radiosonde_auto_rx/station.cfg;;
1[01]) break;;
255) echo "got noopt_exit";;
*) echo rc is $?; echo got wild;;
esac

done

So, when the package is installed and the files above created, at the prompt in the user’s home directory type in ./rsmenu and ENTER… and it should work!

rsmenu.zip