5 ms·
Ask HN: How do I automatically turn Internet off on mc os x?
So I'm doing an experiment[1] where I want to disable internet after 8pm and before 9am. I'm working on mac os x and I was thinking of editing /etc/hosts or something like that, but I couldn't find much info so I'm asking for help. How do I disable internet connection on mac os x via terminal or apple script? Thanks in advance.
[1] http://freestylemind.com/productivity-experiment-internet-diet
- pook 16y agohttp://atmac.org/freedom-turn-off-the-internet-and-get-some-work-done/ http://atmac.org/freedom-turn-off-the-internet-and-get-some-... Freedom does this, apparently pretty well. Not CLI, though, apparently.
- wendroid 16y agoturn the router off, or get one of those timer switches for $5 or put this in /etc/crontab It checks every minute so you still have a window :) */1 0 * * * root ifconfig en0 down */1 1 * * * root ifconfig en0 down */1 2 * * * root ifconfig en0 down */1 3 * * * root ifconfig en0 down */1 4 * * * root ifconfig en0 down */1 5 * * * root ifconfig en0 down */1 6 * * * root ifconfig en0 down */1 7 * * * root ifconfig en0 down */1 8 * * * root ifconfig en0 down */1 9 * * * root ifconfig en0 up */1 10 * * * root ifconfig en0 up */1 11 * * * root ifconfig en0 up */1 12 * * * root ifconfig en0 up */1 13 * * * root ifconfig en0 up */1 14 * * * root ifconfig en0 up */1 15 * * * root ifconfig en0 up */1 16 * * * root ifconfig en0 up */1 17 * * * root ifconfig en0 up */1 18 * * * root ifconfig en0 up */1 19 * * * root ifconfig en0 up */1 20 * * * root ifconfig en0 down */1 21 * * * root ifconfig en0 down */1 22 * * * root ifconfig en0 down */1 23 * * * root ifconfig en0 down
- oscardelben 16y agoThanks, I will probably use this as I don't want to limit access for other computers.
- wendroid 16y agocheck that your interface is actually en0 by typing : ifconfig of course you'll also lose all network, not just the internet I suppose the other way is changing /etc/resolv.conf from nameserver 8.8.8.8 to nameserver 127.0.0.1 8.8.8.8 is google's speedy dns