To improve the user experience on this site we use cookies. I agree | I disagree

He wants to receive a SMS message when the voltage drops below a specific level.

In category Routers .


Example script:
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here.
 
mkdir -p /var/voltaged
Umin=16.3
Num=+420123456789

cat > /var/voltaged/voltaged << EOF
#!/bin/sh
old=0
while true
  do
    Uget=\`status sys | awk '/^Supply Voltage/ { print \$4 }'\`
 
      if [ \$(echo "\$Uget $Umin" | awk '{print (\$1 < \$2)}') == 1 ]; then
        if [ \$old -eq 0 ]; then
          led on
          gsmsms $Num "Low voltage!!! Voltage is only \$Uget V"
          old=1
        fi
      else
        led off
        old=0
      fi
  sleep 5
done
EOF
 
chmod +x /var/voltaged/voltaged
/var/voltaged/voltaged &

 

Copy whole script above to Startup Script, edit varables Umin, Num as you need and reboot the router.

 

 

 

To the FAQ overview