Version 2 GL-USB150 led internet and vpn status indicator

credits to original script modified from keolafu for ar750

Here’s what it does GL-USB150 has two lights power and wwan.
by default the power stays on and wwan just flashes with traffic.
Here is what the scripts below change them too

power button is blinking when there is no internet connectivity and solid when internet is up

wlan button is solid when you are connected to openvpn with a default route of 10.8.x.x address and blinking when it is connected to wireguard with a default route of 10.0.x.x address.

  1. goto and uncheck “default” and set both triggers to “none”

  2. grab a beer

    • upload the two scripts below (e.g. to /usr/bin/). If sftp does not work you can use in your ssh console: cat > full-path-and-filename and simply copy and paste the content of the script (use ctrl-d to get back to your prompt).:point_up: Be careful, the cat > command overwrites everything of the file. Check better twice the correct spelling of the filename before you enter into the command :wink:
    • chmod u+x full-path-and-filename
    • now you can check the scripts by calling them without arguments.
    • to let them call frequently by the system add the cron configuration with the glinet admin web tool or crontab -e

#  /usr/bin/
# crontab -e
# */1 * * * * test -x /usr/bin/ && /usr/bin/


nc -z -w 5 53  >/dev/null 2>&1
if [ $online -eq 0 ]; then
    echo "none" > $inet_trig
    echo 1 > $inet_led
  echo "timer" > $inet_trig

# /usr/bin/
# wlan led is off when  wireguard or openvpn is not connected 
# wlan led is solid when you are connected to openvpn with a 10.8.x.x address
# and 
# wlan led is blinking when it is connected to a wireguard 10.0.x.x address.
# leds may be wrong if you are connectd to one of these networks by wan or wwan
# crontab -e
# or place below line without   "# " 
# */1 * * * * test -x /usr/bin/ && /usr/bin/
# or via browser
# in http:/
enabled=$(uci get glconfig.openvpn.enable)
wgenabled=$(uci get wireguard.@proxy[0].enable)


first_hop1=$(traceroute 2>&1 | head -2 | tail -1 | awk '{print $2}')

if [ "$first_hop" == "10.8" ] && [ "$enabled" == "1" ];then
  echo "none" > $vpn_trig
  echo 1 > $vpn_led 
elif [ "$first_hop" == "10.0" ] && [ "$wgenabled" == "1" ]; then
  echo "timer" > $vpn_trig
  echo 1 > $vpn_led
  echo "none" > $vpn_trig
  echo 0 > $vpn_led
  exit 0;
1 Like