Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
How to enable and disable wireless (cellular, wifi) on Conel, SmartWorkx routers. This is more for v2 routers as v3 does have more options, such as entering power saving mode.

Solution to disable and enable radio interfaces on Conel, SmartWorkx 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
@xromeomustdiex

This comment has been minimized.

Copy link

commented Nov 3, 2017

Dear Thomas,
how i can apply the settings of ppp or wlan or wifi without doing a reboot??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.