Adblock - Weekdays only

Hello,
Is there a way to control the timing so that Adblock is enabled during the weekdays only (In a similar way to how firewall rules work)? I use it to block gaming websites but I want it to do so during workdays only.

Thanks in advance

just add two cron entries, e.g.

# suspend adblock friday night at 00:00
0 0 * * 5 /etc/init.d/adblock suspend

# resume adblock sunday night at 00:00
0 0 * * 0 /etc/init.d/adblock resume

1 Like

Thank you @dibdot. You're a star.

Shouldn't it be like this:

#suspend adblock Saturday night at 00:00
0 0 * * 6 /etc/init.d/adblock suspend

#resume adblock Monday night at 00:00
0 0 * * 1 /etc/init.d/adblock resume

The idea would be to suspend at the start of Saturday and finish at the end of Sunday which would be the start of Monday? I don't know much about Crontab so I could be wrong but I read your script as starting Friday and ending at the start of Sunday.

Also, if you want Ad block to update, you have to add a reload command job as well.

Thank you @lleachii

Does this look right to you guys?

##suspend adblock Saturday at 00:00
0 0 * * 6 /etc/init.d/adblock suspend

##resume adblock Monday at 00:00
0 0 * * 1 /etc/init.d/adblock resume && /etc/init.d/adblock reload

Yes, that should update your Adblock once per week.

Regarding your restart action on Monday it's sufficient to reload adblock, there is no need to explicitly resume beforehand.

1 Like