

Ask HN: looking for a linux script/app to block my Internet from 10pm-6am? - csmeder

2 months ago I didn't have the internet for about a 6 month stretch. In terms of going to bed on time and being rested, no other time in my life compares.<p>I'm looking for something similar to http://macfreedom.com/ but for linux and instead of setting a 3 hour break, I would like it to start automatically at 10pm and stop automatically at 6am.<p>Any scripts/apps out there like this? Or any pointers on how to write one?
======
ecyrb
as su, add crontab entries to call ifup and ifdown: ("crontab -e" to edit
crontab)

* 22 * * * ifdown eth<X>

* 6 * * * ifup eth<X>

where <X> is your ethernet interface.

~~~
csmeder
so this should work? (I am using Lan so I'm guessing eth0)

    
    
      # m h  dom mon dow   command
      * 22 * * * ifdown eth0
      * 6 * * * ifup eth0

~~~
ecyrb
I would guess so. You can check your interfaces with the "ifconfig" command.

------
csmeder
note: I didn't have TV and still don't (as it would foil this plan)...

------
pasbesoin
I seem to recall that some routers/hubs support schedules. In the personal
equipment arena, maybe something that can be flashed with a version of WRT or
with Tomato?

E.g. (although it appears to be only controlling the wireless radio as opposed
to overall connectivity):

Precise Radio Scheduling with DD WRT

<http://markspizz.net/?p=389>

Then again, if you have other data (entertainment, Netfix, etc) flowing
through the same equipment, this approach may not suit or may need refinement.

