Conel router enable,disable wifi and cellular

· 2 min read

Solution to disable and enable radio interfaces on Conel routers based on time.

Solution is to change the setting of the router enable/disable and reboot the router for the setting to be used by router.

I used two time constants:

  • On timer - TIME_ON
  • Off timer - TIME_OFF

Script to copy paste into Configuration -> Start-up Script setting of the Conel router.

#!/bin/sh
FILE=enable_tag
# WARNING
# time is in seconds
# 3Hours = 10800
# 2Hours = 7200
# 1Hour = 3600
# 30min = 1800
TIME_ON=1800
TIME_OFF=3600

while true
do 
if [ -f $FILE ];
then
   echo "File $FILE exists"
   echo "Disabling Cellular and WiFi for $TIME_OFF"
	sed "1s/PPP_ENABLED=1/PPP_ENABLED=0/" -i /etc/settings.ppp
	sed "1s/WLAN_ENABLED=1/WLAN_ENABLED=0/" -i /etc/settings.wlan
	sed "1s/WIFI_ENABLED=1/WIFI_ENABLED=0/" -i /etc/settings.wifi
	echo "Disabled"
	rm $FILE
	sleep $TIME_OFF
	reboot	
else
   echo "File $FILE does not exists"
   echo "Enabling Cellular and WiFi for $TIME_ON"
   sed "1s/PPP_ENABLED=0/PPP_ENABLED=1/" -i /etc/settings.ppp
	sed "1s/WLAN_ENABLED=0/WLAN_ENABLED=1/" -i /etc/settings.wlan
	sed "1s/WIFI_ENABLED=0/WIFI_ENABLED=1/" -i /etc/settings.wifi
	echo "Enabled"
	touch $FILE
	sleep $TIME_ON
	reboot
fi
sleep 1
done

Here is the configuration snippet. Copy&Paste into text file and use it in Administration -> Restore Configuration

STARTUP=#!/bin/sh
STARTUP=FILE=enable_tag
STARTUP=# WARNING
STARTUP=# time is in seconds
STARTUP=# 3Hours = 10800
STARTUP=# 2Hours = 7200
STARTUP=# 1Hour = 3600
STARTUP=# 30min = 1800
STARTUP=TIME_ON=1800
STARTUP=TIME_OFF=3600
STARTUP=
STARTUP=while true
STARTUP=do 
STARTUP=if [ -f $FILE ];
STARTUP=then
STARTUP=   echo "File $FILE exists"
STARTUP=   echo "Disabling Cellular and WiFi for $TIME_OFF"
STARTUP=    sed "1s/PPP_ENABLED=1/PPP_ENABLED=0/" -i /etc/settings.ppp
STARTUP=    sed "1s/WLAN_ENABLED=1/WLAN_ENABLED=0/" -i /etc/settings.wlan
STARTUP=    sed "1s/WIFI_ENABLED=1/WIFI_ENABLED=0/" -i /etc/settings.wifi
STARTUP=    echo "Disabled"
STARTUP=    rm $FILE
STARTUP=    sleep $TIME_OFF
STARTUP=    reboot  
STARTUP=else
STARTUP=   echo "File $FILE does not exists"
STARTUP=   echo "Enabling Cellular and WiFi for $TIME_ON"
STARTUP=   sed "1s/PPP_ENABLED=0/PPP_ENABLED=1/" -i /etc/settings.ppp
STARTUP=    sed "1s/WLAN_ENABLED=0/WLAN_ENABLED=1/" -i /etc/settings.wlan
STARTUP=    sed "1s/WIFI_ENABLED=0/WIFI_ENABLED=1/" -i /etc/settings.wifi
STARTUP=    echo "Enabled"
STARTUP=    touch $FILE
STARTUP=    sleep $TIME_ON
STARTUP=    reboot
STARTUP=fi
STARTUP=sleep 1
STARTUP=done

Related Articles

4G Router Advantech FW 6.2.4
· 1 min read
4G Routers SNMP trap on exception
· 3 min read
Manage Advantech Routers easy way
· 3 min read
4G Router metrics and alarms in Slack
· 2 min read
Advantech 4G,3G Routers FW 6.1.8
· 1 min read