Startup script for wireless schedule

Post new topic   Reply to topic    DD-WRT Forum Forum Index -> Atheros WiSOC based Hardware
Author Message
boghea
DD-WRT Novice


Joined: 25 Mar 2012
Posts: 4

PostPosted: Sun Mar 25, 2012 9:28    Post subject: Startup script for wireless schedule Reply with quote
Hi,

Is it possible to make an script that when the router is rebooted (on startup) it will check if wireless interface should be up in a specified time interval (when the router is rebooted wireless by default will be up) and if that's the case it will turn off the wireless until crond will turn it on.

It would be very nice if a graphical menu will be included in future builds because from my point of view this is very important (security and health)

After many trials and errors I have found the combination of commands that work very well with cron in r18777:

00 00 * * * root /sbin/ifconfig ath0 down; /usr/sbin/iwconfig ath0 txpower 0
00 10 * * * root /sbin/ifconfig ath0 up; /usr/sbin/iwconfig ath0 txpower 20

This turns off the wireless every day at 00:00 and turns on every day at 10:00 AM
Sponsor
pianoralf
DD-WRT Novice


Joined: 02 Apr 2012
Posts: 2

PostPosted: Mon Apr 02, 2012 13:07    Post subject: Reply with quote
Hi bohea
thank you very much for posting this.
I have tried serveal hours without succuss, until I found your advice to put the second command /usr/sbin/iwconfig ath0 txpower 0 seperated with ";" after the first command "ifconfig ath0". I eperimented with both. So now I am lucky on my device TL-WR1043ND. Now I can turn off my device during the night.
Best regards and thanks
Ralf
Mistikal
DD-WRT Novice


Joined: 16 Jun 2012
Posts: 3

PostPosted: Fri Jun 22, 2012 14:34    Post subject: Reply with quote
Can you help me. I use wr1043nd but not work. I'm a beginner and don't know dd-wrt. You can explain me the procedure?
numerci
DD-WRT User


Joined: 02 May 2012
Posts: 50

PostPosted: Sun Jun 24, 2012 5:09    Post subject: Reply with quote
+1 Please give us some more details where you place these commands.

I have tried to set these in the Administration>Commands and save to Startup but nothing happens. Also tried to add the commends to Administration>Management>Cron but still nothing.

Do you connect with putty and run these commands?

PS: I am also using build 18777
checho
DD-WRT User


Joined: 27 Feb 2007
Posts: 492
Location: Bulgaria

PostPosted: Sun Jun 24, 2012 5:15    Post subject: Reply with quote
What about
stopservice lan
startservice lan

these should even stop wired connection. If there are changes applied to the config at this time, they automatically apply.

For example I am providing internet access to a public cafe bar. But they want to have password so that nobody from the same building connects for free. I have arranged it so that the wpa password changes every night like so: 'cafebarXX' where XX is the day of month. For example on the 15th each month the password is cafebar15, on the 16th it would be cafebar16 etc.
numerci
DD-WRT User


Joined: 02 May 2012
Posts: 50

PostPosted: Sun Jun 24, 2012 14:16    Post subject: Reply with quote
Well I have found out how should be done. The two lines from the first post need to be placed in the Administration>Management>Additional Cron Jobs

The problem is in a different part: even if the txpower is set o 0 or off the router is still broadcasting.

Does anyone know another option that can be used to completely switch off the wireless? I have searched for one but no luck yet.

Some thing similar with selecting Wireless Network Mode = Disabled
xam_max
DD-WRT User


Joined: 27 Mar 2008
Posts: 155

PostPosted: Sun Jun 24, 2012 14:49    Post subject: Reply with quote
http://www.dd-wrt.com/phpBB2/viewtopic.php?t=11457

Try with wl radio off - wl radio on
numerci
DD-WRT User


Joined: 02 May 2012
Posts: 50

PostPosted: Sun Jun 24, 2012 15:46    Post subject: Reply with quote
I have already tried this. It only works with Broadcom:
http://www.dd-wrt.com/wiki/index.php/Wl_command

For atheros there is wl_atheros but nothing happens when invoked with radio off.
checho
DD-WRT User


Joined: 27 Feb 2007
Posts: 492
Location: Bulgaria

PostPosted: Sun Jun 24, 2012 18:30    Post subject: Reply with quote
numerci wrote:
I have already tried this. It only works with Broadcom:
http://www.dd-wrt.com/wiki/index.php/Wl_command

For atheros there is wl_atheros but nothing happens when invoked with radio off.


I have written the commands you need in my previous post here. But since you don't want to read...
numerci
DD-WRT User


Joined: 02 May 2012
Posts: 50

PostPosted: Sun Jun 24, 2012 19:05    Post subject: Reply with quote
Sorry but with your solution doesn't work either. This was added to cron:
15 22 * * * stopservice lan
20 22 * * * startservice lan
xam_max
DD-WRT User


Joined: 27 Mar 2008
Posts: 155

PostPosted: Mon Jun 25, 2012 17:23    Post subject: Reply with quote
numerci wrote:
I have already tried this. It only works with Broadcom:
http://www.dd-wrt.com/wiki/index.php/Wl_command

For atheros there is wl_atheros but nothing happens when invoked with radio off.


use ifconfig ath0 down and ifconfig ath0 up
numerci
DD-WRT User


Joined: 02 May 2012
Posts: 50

PostPosted: Mon Jun 25, 2012 18:04    Post subject: Reply with quote
These commands are part of the first post and will make the wireless network not connectable but will still broadcast signal. This is what I want to achieve.

None of the commands on this thread has stopped the broadcast. These only made to network connection impossible.
xam_max
DD-WRT User


Joined: 27 Mar 2008
Posts: 155

PostPosted: Sat Jul 07, 2012 21:50    Post subject: Reply with quote
Any news? Rolling Eyes
numerci
DD-WRT User


Joined: 02 May 2012
Posts: 50

PostPosted: Sun Jul 08, 2012 5:03    Post subject: Reply with quote
Yes and no.

ON WRT160NL works fine be adding something like this in CRON:
30 08 * * 1 root /sbin/ifconfig ath0 down; iwconfig ath0 txpower off
00 18 * * 1 root /sbin/ifconfig ath0 up
Don't forget to restart the router after adding them.

However on WR740N it doesn't work. My guess is that because this is used as a Client Bridge. Found a very old post stating that is not supposed to work in Client Bridge mode. I would have liked to shot down the bridge when is not in use...
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Forum Index -> Atheros WiSOC based Hardware All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum