I am trying to make a productivity suite for myself. My first goal is to block Facebook, Gmail and Stackexchange from 0900 to 1600.
As of now, I have edited my
/etc/hosts and added 0.0.0.0 www.facebook.com and similar ones for gmail and stackexchange.
But I am a little confused about how to include the blocking duration in my script.
What I thought is having 2 different files (hosts_allow, hosts_block) and then
cp hosts_allow hosts or
cp hosts_block hosts depending upon time but then this would need to be put in an infinite loop or something which I'm not really sure is the best way of approaching the problem.