What's new

amtm WAN service schedule off/on script ?

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

Totally a wild guess, but I'm thinking you could do this:

Code:
/usr/sbin/cru a WANOFF "0 2 * * * nvram set wan0_enable=0 && nvram commit"

/usr/sbin/cru a WANON "0 6 * * * nvram set wan0_enable=1 && nvram commit"

This would add 2 cronjobs... one will turn the WAN off at 2am, the other will turn it back on at 6am. Good luck! :)

And if that works out for you, you'd need to add these 2 statements to your /jffs/scripts/services-start file, so these jobs will survive a reboot.
 
Totally a wild guess, but I'm thinking you could do this:

Code:
/usr/sbin/cru a WANOFF "0 2 * * * nvram set wan0_enable=0 && nvram commit"

/usr/sbin/cru a WANON "0 6 * * * nvram set wan0_enable=1 && nvram commit"

This would add 2 cronjobs... one will turn the WAN off at 2am, the other will turn it back on at 6am. Good luck! :)

And if that works out for you, you'd need to add these 2 statements to your /jffs/scripts/services-start file, so these jobs will survive a reboot.
Not working seems :( i tested with a lot of days but wan service isnt turned off/on :(
 
Not working seems :( i tested with a lot of days but wan service isnt turned off/on :(
Can you test it manually? Just run these 2 commands on your router... and see if it turns off your WAN?

Code:
nvram set wan0_enable=0
nvram commit
 
Can you test it manually? Just run these 2 commands on your router... and see if it turns off your WAN?

Code:
nvram set wan0_enable=0
nvram commit
It does work, it turns the wan service off, but it does not leave me without internet.

On the other hand, if I do it from the router panel and I put the wan service on off, I am left without internet.

So what is the difference and what is wrong?
 
By itself changing the value of an nvram variable doesn't do anything. You have to restart the service that uses that variable.
 
You might want to try these.

Code:
service stop_wan

Should bring down the wan interface.

Code:
service start_wan

Should bring it back up.

I just tested this on an AX58U running 3004.388.6 and it worked fine.
 
You might want to try these.

Code:
service stop_wan

Should bring down the wan interface.

Code:
service start_wan

Should bring it back up.

I just tested this on an AX58U running 3004.388.6 and it worked fine.
Nice call, @JGrana! So in that case, @brodas ... you could do something like this:

Code:
/usr/sbin/cru a WANOFF "0 2 * * * service stop_wan"

/usr/sbin/cru a WANON "0 6 * * * service start_wan"
 
May I ask why is this needed? Thank you.
 
You might want to try these.

Code:
service stop_wan

Should bring down the wan interface.

Code:
service start_wan

Should bring it back up.

I just tested this on an AX58U running 3004.388.6 and it worked fine.
Nice call, @JGrana! So in that case, @brodas ... you could do something like this:

Code:
/usr/sbin/cru a WANOFF "0 2 * * * service stop_wan"

/usr/sbin/cru a WANON "0 6 * * * service start_wan"
Thank you very much to both of you. I have updated the call and see if it works. I will let you know later.
 
May I ask why is this needed? Thank you.
So you can "go dark"... don't you do this? Then the hackers can't find you between 10pm and 6am!
 
Thank you very much to both of you. I have updated the call and see if it works. I will let you know later.
From an SSH prompt, make sure you see these 2 jobs in your list by running:

Code:
cru l
 
May I ask why is this needed? Thank you.
If you have a provider that gives you dynamic ip, with this script your ip will rotate while you sleep. And if you have scraping scripts then they will skip the ban while you sleep or do other things. I expect that it has served you.
 

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top