Finally, I found the time to try "Greg from Oz" solution. It works perfectly. I publish here the code and what I've done in case someone needed it.
1. The first step is to convert the standard Sqlite database into a mysql one. This is quite simple and could offer you other advantages. 2. The user for the weewx database in the example below is: user=weewx and password=weewx 3. I used this program https://github.com/codazoda/hub-ctrl.c in order to switch on and switch off the USB of the Raspberry 4. I created two files: RXcheck.sh (that contain the code) and RXout.txt (that memorize the last console shutdown time in UNIX epoch) 5. Put a random small number in RXout.txt to avoid problems if RXcheck.sh can't find a number into that file (for example put a "0" inside that file) 6. The code in RXout.txt is: #!/bin/bash RXCHECK=$(mysql --batch --column-names=0 -uweewx -pweewx --database=weewx --execute="select rxCheckPercent from archive WHERE dateTime=(select MAX(dateTime) from archive);"); RXCHECK=`echo $RXCHECK | awk '{printf("%.1f", $1)}'` if [ ! ${RXCHECK} = "100.0" ] then pastTime=$(</home/weewx/RXout.txt) presTime=$(date +%s) delta=$(($presTime - $pastTime)) #echo $delta if [ ${delta} -gt 1800 ] #I don't want to restart the console two times in 30min = 1800s then echo $presTime > /home/weewx/RXout.txt /home/weewx/hub-ctrl -h 0 -P 2 -p 0 #switch off the console (remember to remove the batteries or it's impossible to shutdown the console) sleep 5 /home/weewx/hub-ctrl -h 0 -P 2 -p 1 #switch on the console fi fi 7. using "sudo crontab -e" I ordered the execution of RXcheck.sh every 5 minutes. It's important to use the *sudo* crontab for the hub-ctrl. Thank you so much for your help. I hope this thread could be useful for others. By -- You received this message because you are subscribed to the Google Groups "weewx-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.