After one connection to VARA (HF OR FM) from RadioMail, the VARA ports are no longer available. I wrote a quick & dirty script for the Pi to watch for the ports to close, wait for a period of time, and then restart VARA automatically. This allows the new VARA session to bind with the ports correctly gain. Below is the script but you may need to make adjustments for your environment. In my case, I call the VARA start script in the Pat Menu directory to restart VARA. This obviously won't work if you don't have Pat Menu on your system. For this script to work, VARA should be started first and then this script.
73, de KM4ACK
#/bin/bash
#script watches VARA. When the ports disappear, it will start a countdown,
#close the current vara session, and restart a new instance.
#the ports disappear as soon as an external source connects so this time
#needs to be long enough so that the external connection has enough time to
#complete it's connection before the script kills vara and start a new vara session.
#how many seconds the script waits after ports close before restarting vara
SEC=60
#path to vara startup script
VARA=$HOME/patmenu2/start-vara-fm
MAIN(){
VARAPORT=$(netstat -lntu | grep 8301)
x=1
clear;echo;echo
echo "Use ctrl+c to exit"
while [ -n "$VARAPORT" ]; do
echo "monitoring VARA $x"
VARAPORT=$(netstat -lntu | grep 8301)
sleep 2
((x++))
done
echo "vara port not found"
echo "will restart VARA in $SEC seconds"
sleep $SEC
echo "restarting VARA"
#kill current VARA modem
VARA=$(ps aux | grep wine | grep VARA | head -1 | awk '{print $2}')
kill -9 $VARA > /dev/null 2>&1
VARA=$(ps aux | grep wine | grep VARA | head -1 | awk '{print $2}')
kill -9 $VARA > /dev/null 2>&1
#call start up script
$VARA &
#give VARA a chance to start before we monitor again
sleep 30
}
#this runs the above function in a constant loop
while true; do
MAIN
done