Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

7Deuce

macrumors newbie
Original poster
Mar 24, 2011
2
0
Hey, newbie programmer here. I would like to write a program that can block a website during a given time of day. I've read around a bit and it seems one possibility would be to write a script that edits /etc/hosts and use launchd/cron(?) to make it run at the desired times. What other ways are there of doing this? I would be looking to do this in python.
 
I think this is the most efficient way, /etc/hosts and cron/launchd being the most low level tools for this.

Eventually you might not use cron/launchd and use your own way of timing. But /etc/hosts is for me the way to go.
 
+1 for /etc/hosts

An alternative is an SOCKS proxy for all traffic or an in browser solution like Leechblock.
 
I think this is the most efficient way, /etc/hosts and cron/launchd being the most low level tools for this.

Eventually you might not use cron/launchd and use your own way of timing. But /etc/hosts is for me the way to go.

Use Celery (a Python framework). It works great as a cron replacement and is extremely powerful. You'll appreciate the fact that you learnt it in many other projects as well.
 
Thanks for all the ideas guys.

I think this is the most efficient way, /etc/hosts and cron/launchd being the most low level tools for this.

Eventually you might not use cron/launchd and use your own way of timing. But /etc/hosts is for me the way to go.

What kind of things did you have in mind when you said 'your own way of timing'?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.