Hacker News new | comments | ask | show | jobs | submit login

The /etc/hosts hack actually works. I don't use noprocrast since I need to visit news.yc for other good reasons during my work.

But the trick that really made the difference is this. I run a cron job which will over write the /etc/hosts with a file which has yc/reddit blocked. This way, when ever I open access for good reasons or even to have my 30 minutes per day of YC reading, the file gets overwritten in the next 30 min window and I get fed up with editing it again and again. So I give up and go back to work, sort of like nagging myself very effectively.




I use the /etc/hosts block, but defeat myself if I edit it... would you be willing to share the cron job? Much oblidged!


If I understood correctly it should be as simple as having an extra file setup to replace your hosts file say /etc/hosts.override and put all your blocked hosts there along with your regular hosts file.

Then you just add a 30 minute cron job to do

    cp /etc/hosts.override /etc/hosts


This is exactly how you do it. Setting up a cron job to run every 30 minutes can be done like this: crontab -e and put this line in there 0,30 * * * * your_command or like 0/30 * * * * your_command. The second one works for me, I am on a mac.

Make sure the user who runs the job has permission to overwrite the file.


Fantastic thanks. Running with that and extending it a bit.. I want it to turn distractions off between 8am to 11am, I'm doing it with hosts.on and hosts.off, so I can have it all come back online again at 11am. Cheers!




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: