FOR TIPS, gUIDES & TUTORIALS

subscribe to our Youtube

GO TO YOUTUBE

14455 questions

17168 answers

28195 comments

0 members

We are migrating to our new platform at https://community.teltonika.lt. Moving forward, you can continue discussions on this new platform. This current platform will be temporarily maintained for reference purposes.
0 votes
1,429 views 2 comments
by
Hello all,

in another question there is a description how to turn on/off Wifi via crontab.

But how can be achieved that Wifi is enabled when powering on RUT955 but after a certain runtime (e.g. 15min.) Wifi will automatically be disabled?

Thank you!

1 Answer

0 votes
by anonymous

Greetings.

If your goal is to disable WiFi after 15 minutes after router was restarted. Then you can use crontab to simply disable Wifi every 15 minutes. But once the WiFi is off, you will have to enable it manually, because even the router will restarted the WiFi will stay off.

To summarize: router starts, WiFi is turned of after 15 minutes. And it stays off. You have to enable Wifi manually. 

To achieve this connect to router CLI. And edit crontab. With: crontab -e

Next enter this command on the line into the file and save it (you will be using VI editor and it is a bit complicated, look for explanation on how to edit at the bottom of the post):

*/15 * * * * uci set wireless.@wifi-iface[0].user_enable=0 && uci set wireless.@wifi-iface[0].disabled=1 && uci commit && wifi

*/15 - means after 15 minutes. To learn more about crontab commands visit Teltonika Wiki: https://wiki.teltonika.lt/view/Crontabs

Restart the router and wait for results.

This procedure was tested and worked perfectly.
 

To Enable Wifi 

  1. Simple enable using Web Interface
  2. Enable via CLI with this command:
uci set wireless.@wifi-iface[0].user_enable=1 && uci delete wireless.@wifi-iface[0].disabled && uci commit && wifi

Vi Editor Instructions

Input mode

The input mode lets you insert or append text. To insert text before the cursor's current position, in command mode, press i. Similarly, to append after the cursor, you can type a. Remember that you can't move around with the cursor keys in this mode. When you're done entering text, press Esc to go back to command mode.

Exit mode

The ex mode is an extension of command mode. To get into it, press Esc and then : (the colon). The cursor will go to the bottom of the screen at a colon prompt. Write your file by entering :w and quit by entering :q. You can combine these to save and exit by entering :wq. However, if you're finished with your file, it's generally more convenient to type Shift-z-z from command mode.

Best answer
by
Thank you!

So if always after startup Wifi shall be up for 15 min. I have to add another script that is run after booting which enables Wifi

How can I achieve this?
by anonymous

It depends how you are going to shut down your router. You could run the script below before shutdown. 

To start WiFi back use the script below, but it only works if the WiFi is already disabled with the previous commands.
 

To Enable Wifi 

  1. Simple enable using Web Interface
  2. Enable via CLI with this command:
uci set wireless.@wifi-iface[0].user_enable=1 && uci delete wireless.@wifi-iface[0].disabled && uci commit && wifi