User Tools

Site Tools


WiFi off during night

We will use cron. It is a time-based job scheduler in Linux which runs in the background of your system. That means it can start scripts and even apps, provided you set everything up correctly. You can specify the time to start your scripts / apps or you can specify an interval. Minimum interval is 1 minute

Now, login to LuCI (by default it should be here: http://192.168.1.1/cgi-bin/luci)

Jump straight to the SystemScheduled tasks and copy&paste script, which you want use for automatic shutdown WiFi and automatic turn on WiFi.

Script 1

Each working day (Monday-Friday) at 1:00 it will shutdown your WiFi and turn it back on at 7:00. During weekend it will turn off WiFi at 1:25 and turn it back on at 9:50

00 1 * * 1-5 wifi down
00 7 * * 1-5 wifi up

25 1 * * 6-7 wifi down
50 9 * * 6-7 wifi up

Script 2

This script will shutdown WiFi at 22:30 (10:30 pm) and turn it on at 6:30

30 22 * * * wifi down
30 6 * * * wifi up

There should be an end-of-line (EoL) character on the last line of the crontab file. If in doubt, just leave an empty line at the end, otherwise it won't work.

Explanation of each line in scripts

The best explanation you can find in Wikipedia and I copy&pasted it here:

You can also use sites such as https://crontab.guru/ and https://crontab-generator.org/ which make it easier to write valid cron schedules.

After importing script

After successful import of first script, you should see something like this:

# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/etc/crontabs/root installed on Fri Mar 24 00:05:33 2017)
# (Cron version V5.0 -- $Id: crontab.c,v 1.12 2004/01/23 18:56:42 vixie Exp $)

00 1 * * 1-5 wifi down
00 7 * * 1-5 wifi up

25 1 * * 6-7 wifi down
50 9 * * 6-7 wifi up

It means you did it! You're welcome and now you can jump to another article.

FAQ

Q: My WiFi was turned off early and I need it for a while.

Not really a question, but for now you have only two options:

1) On a computer which is connected to your network using wired connection you can connect to the LuCi page or use SSH to connect to Turris Omnia’s SSH server, where you will have to type or copy&paste only this command to start WiFi:

wifi up

2) If you have a VPN server enabled on the Omnia, then you can connect to your local network from an outside network (for example from your neighbours’ WiFi, provided that you’re allowed to use it). After connecting to the VPN server, you can then go to the LuCi page on the Omnia or connect to the SSH server and enable WiFi from there (see point method #1)

Somebody might say: “Both options are not good for me!” Unfortunately I have for them this respond: You need to extend your time in LuCI how you need. but..

If you have time and you want to help yourself and others Turris users, please look at this thread about HW button for WiFi, which would be really usefull for everyone.