WLAN and cron - WLAN Zeitgesteuert / and other Cronjobs

Post new topic   Reply to topic    DD-WRT Forum Index -> Contributions Upload
Goto page 1, 2  Next
Author Message
HWS
DD-WRT Guru


Joined: 06 Jun 2006
Posts: 579
Location: Germany

PostPosted: Wed Jun 21, 2006 17:16    Post subject: WLAN and cron - WLAN Zeitgesteuert / and other Cronjobs Reply with quote
  • english
    • Switch off your WLAN at night.
      How does cron works?
  • deutsch
  • español
    • Desconecta tu WLAN de noche.

See also Known Bugs.
Put this codesnippets in your commands-Window, or combine some scripts together, than click "save startup"
Ensure that Option Administration/Management/Cron is enabled !

Example: 01:00h switch off / 11:00h switch on 'daily
Code:
echo '00 01 * * * root /usr/sbin/wl radio off' > /tmp/cron.d/wlanonoff
echo '00 11 * * * root /usr/sbin/wl radio on' >> /tmp/cron.d/wlanonoff
Example: 01:00h switch off / 11:00h switch on 'MO-FR (untested)
Code:
echo '00 01 * * 1-5 root /usr/sbin/wl radio off' > /tmp/cron.d/wlanonoff
echo '00 11 * * 1-5 root /usr/sbin/wl radio on' >> /tmp/cron.d/wlanonoff

If your Power LED is blinking, and you don't want to see blinking try this:
Code:
echo '00 01 * * 1-5 root /usr/sbin/wl out' > /tmp/cron.d/wlanonoff
echo '00 11 * * 1-5 root /usr/sbin/wl up' >> /tmp/cron.d/wlanonoff
Note, that your WLan-LED always is on.

//** ------ Reboot script ' daily ------ **//
Example: Reboot your router at 01:10h and 07:50h
Code:
echo '10 01 * * * root /sbin/reboot' > /tmp/cron.d/myreboot
echo '50 07 * * * root /sbin/reboot' >> /tmp/cron.d/myreboot


//** ------ combine both scripts ------ **//
Code:
echo '00 01 * * * root /usr/sbin/wl radio off' > /tmp/cron.d/wlanonoff
echo '00 11 * * * root /usr/sbin/wl radio on' >> /tmp/cron.d/wlanonoff
echo '10 01 * * * root /sbin/reboot' > /tmp/cron.d/myreboot
echo '50 07 * * * root /sbin/reboot' >> /tmp/cron.d/myreboot


//** ------ reset your PPPoE-Line without rebooting router ------ **//
Example: Reset PPPoE connection at 09:00h daily
Code:
echo '00 09 * * * root killall -HUP pppoecd' > /tmp/cron.d/ppprecon
I'v testet with PPPoE, not with RP PPPoE.

Following code is the old one. But better you don't use this.
Code:
echo '00 09 * * * root /tmp/ppp/ip-down ppp0' > /tmp/cron.d/ppprecon


//** ------ reset your PPTP-Line without rebooting router ------ **//
Example: Reset PPTP connection at 09:00h daily
Code:
echo '00 09 * * * root stopservice pptpd;startservice pptpd' > /tmp/cron.d/ppprecon


Known Bugs:
This will not work with DD-WRT v23 SP1.
This will not work with DD-WRT v23 SP1 Final (06/19/06)
* Flash a better version from here

_________________
DD-WRT v23 SP2 (09/13/06) std on WRT54GL V1.1
Last News


Last edited by HWS on Tue Aug 15, 2006 16:28; edited 13 times in total
Sponsor
Striker
DD-WRT User


Joined: 07 Jun 2006
Posts: 169

PostPosted: Wed Jun 21, 2006 19:01    Post subject: Reply with quote
This will still use all the security settings right?
And just to make sure I'm not reading this wrong, the example you gave, of shutting off at 0900, is different then the actually code says right? If I am reading it right, it looks like the code is set to shut off at 0100 and come back on at 1100.
catalyst
DD-WRT User


Joined: 11 Jun 2006
Posts: 162
Location: DE

PostPosted: Sun Jun 25, 2006 17:24    Post subject: Reply with quote
moinsen,

wenn man Wlan manuell deaktiviert, holt der router sich eine neue IP bzw. trennt pppoe, ist das bei dem script auch so? oder bleibt die verbindung erhalten nach dem er das wlan an bzw. aus gemacht hat?

kann bei uns schon mal am wochenende vorkommen das um 1 uhr nachts gezoggt wird (aber nicht über wlan) und dann ist das geschrei groß!

greez,
catalyst
HWS
DD-WRT Guru


Joined: 06 Jun 2006
Posts: 579
Location: Germany

PostPosted: Sun Jun 25, 2006 17:42    Post subject: Reply with quote
catalyst wrote:
... ist das bei dem script auch so?
Noppes, PPPoE bleibt davon unberührt, also online.
_________________
DD-WRT v23 SP2 (09/13/06) std on WRT54GL V1.1
Last News
catalyst
DD-WRT User


Joined: 11 Jun 2006
Posts: 162
Location: DE

PostPosted: Sun Jun 25, 2006 18:12    Post subject: Reply with quote
HWS wrote:
catalyst wrote:
... ist das bei dem script auch so?
Noppes, PPPoE bleibt davon unberührt, also online.


danke dir! Wink
Lucky
DD-WRT User


Joined: 14 Jun 2006
Posts: 198

PostPosted: Wed Jun 28, 2006 12:40    Post subject: Reply with quote
Gut, das PPPoE bleibt unberührt, wie sieht es mit den Sicherheitseinstellungen aus? Werden die übernommen? Sprich ist nachdem neustarten vom WLAN der WEP Key gesetzt und wird die Mac Filter Tabelle weiter benutzt?

Larix
HWS
DD-WRT Guru


Joined: 06 Jun 2006
Posts: 579
Location: Germany

PostPosted: Wed Jun 28, 2006 18:31    Post subject: Reply with quote
Lucky wrote:
wie sieht es mit den Sicherheitseinstellungen aus? Sprich ist nachdem neustarten vom WLAN der WEP Key gesetzt
Ja, ist so.
Lucky wrote:
... und wird die Mac Filter Tabelle weiter benutzt?
Ich verwende keine Mac Filter Tabelle, aber denke das es so ist.
"wl radio off" oder "wl radio on" greift direkt in den WL-Treiber ein um ihn zu schalten, dabei werden keine weiteren Einstellungen verstellt.

_________________
DD-WRT v23 SP2 (09/13/06) std on WRT54GL V1.1
Last News
Lucky
DD-WRT User


Joined: 14 Jun 2006
Posts: 198

PostPosted: Thu Jun 29, 2006 10:23    Post subject: Reply with quote
Code:
echo '00 01 * * 1-5 root /usr/sbin/wl radio off' > /tmp/cron.d/wlanonoff
echo '30 16 * * 1-5 root /usr/sbin/wl radio on' >> /tmp/cron.d/wlanonoff
echo '00 02 * * 0,6 root /usr/sbin/wl radio off' > /tmp/cron.d/wlanonoff
echo '00 08 * * 0,6 root /usr/sbin/wl radio on' >> /tmp/cron.d/wlanonoff

Ich kenne mich zwar mit Cronjobs aus, benötige dennoch aber mal einen zweiten Blick über meine Crontabs.
Ich möchte in der Woche sprich Mo-Fr das WLAN nachts um 1 Uhr ausmachen und erst gegen 16:30 Uhr an. Am Sa und So soll das WLAN aber erst gegen 2 Uhr ausgehen und schon um 8 Uhr morgens angehen. Dann müsste mein Crontab doch so aussehen, oder habe ich einen Denkfehler drin?

Lucky
catalyst
DD-WRT User


Joined: 11 Jun 2006
Posts: 162
Location: DE

PostPosted: Thu Jun 29, 2006 14:58    Post subject: Reply with quote
HWS wrote:
Lucky wrote:
wie sieht es mit den Sicherheitseinstellungen aus? Sprich ist nachdem neustarten vom WLAN der WEP Key gesetzt
Ja, ist so.
Lucky wrote:
... und wird die Mac Filter Tabelle weiter benutzt?
Ich verwende keine Mac Filter Tabelle, aber denke das es so ist.
"wl radio off" oder "wl radio on" greift direkt in den WL-Treiber ein um ihn zu schalten, dabei werden keine weiteren Einstellungen verstellt.


kann bestätigen bleibt alles wie es ist Smile
HWS
DD-WRT Guru


Joined: 06 Jun 2006
Posts: 579
Location: Germany

PostPosted: Thu Jun 29, 2006 15:40    Post subject: Reply with quote
Lucky wrote:
Code:
echo '00 01 * * 1-5 root /usr/sbin/wl radio off' > /tmp/cron.d/wlanonoff
echo '30 16 * * 1-5 root /usr/sbin/wl radio on' >> /tmp/cron.d/wlanonoff
echo '00 02 * * 0,6 root /usr/sbin/wl radio off' > /tmp/cron.d/wlanonoff
echo '00 08 * * 0,6 root /usr/sbin/wl radio on' >> /tmp/cron.d/wlanonoff

Ich kenne mich zwar mit Cronjobs aus, benötige dennoch aber mal einen zweiten Blick über meine Crontabs.
In der dritten Zeile fehlt ein ">", also ">>" einsetzten, sonst löscht die dritte Zeile wieder Zeile 1 und 2.
Ansonsten funktioniert es. Wink

_________________
DD-WRT v23 SP2 (09/13/06) std on WRT54GL V1.1
Last News
Lucky
DD-WRT User


Joined: 14 Jun 2006
Posts: 198

PostPosted: Thu Jun 29, 2006 16:10    Post subject: Reply with quote
Stimmt. :D

Larix
atzekalle
DD-WRT User


Joined: 07 Jun 2006
Posts: 313

PostPosted: Sun Jul 02, 2006 21:10    Post subject: Reply with quote
also irgendwie funktioniert das nicht Confused
Quote:
~ # cat /tmp/cron.d/wlanonoff
00 23 * * * root /usr/sbin/wl down
00 11 * * * root /usr/sbin/wl up
cron ist aktiv, Firmware: DD-WRT v23 SP1 Final (06/19/06) st

hatte es gestern mit wl radio off/on probiert, ging auch nicht..

laut http://www.newbie-net.de/anleitung_cron.html sind die angaben ja ok, oder nicht?

_________________
greez atzekalle
_________________

WRT54Gv3.1 01/02/08-dd-wrt.v24.std RC6.2
HWS
DD-WRT Guru


Joined: 06 Jun 2006
Posts: 579
Location: Germany

PostPosted: Mon Jul 03, 2006 15:25    Post subject: Reply with quote
atzekalle wrote:
also irgendwie funktioniert das nicht Confused
...
cron ist aktiv, Firmware: DD-WRT v23 SP1 Final (06/19/06) st

Genau diese Firmware hat ein Problem mit cron.

_________________
DD-WRT v23 SP2 (09/13/06) std on WRT54GL V1.1
Last News
atzekalle
DD-WRT User


Joined: 07 Jun 2006
Posts: 313

PostPosted: Mon Jul 03, 2006 15:29    Post subject: Reply with quote
HWS wrote:
atzekalle wrote:
also irgendwie funktioniert das nicht Confused
...
cron ist aktiv, Firmware: DD-WRT v23 SP1 Final (06/19/06) st
Genau diese Firmware hat ein Problem mit cron.
d'oh Cool
tnx


dann werd ich mal updaten ... brb

_________________
greez atzekalle
_________________

WRT54Gv3.1 01/02/08-dd-wrt.v24.std RC6.2
atzekalle
DD-WRT User


Joined: 07 Jun 2006
Posts: 313

PostPosted: Tue Jul 04, 2006 18:08    Post subject: Reply with quote
danke, funktioniert jetzt. Laughing
_________________
greez atzekalle
_________________

WRT54Gv3.1 01/02/08-dd-wrt.v24.std RC6.2
Goto page 1, 2  Next Display posts from previous:    Page 1 of 2
Post new topic   Reply to topic    DD-WRT Forum Index -> Contributions Upload 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