Time Based Blocking

With Cop+ 3.0 you can block sites during office hours but allow them on evenings and weekends. Here's how.

In this example we will block facebook, myspace and youtube from 8AM to 5PM on weekdays only. They will be allowed on weekends and evenings.

Use WinSCP to create a new text file on IPCop. (Don't use a text file created by windows or notepad, the line endings will be incompatible.)
create /etc/dansguardian/lists/timelimitdomains

The owner and group should be changed to "nobody" inside this file should read:
#time: 8 0 17 0 01234
The colon after the word time is significant, as well as the single # before it. It requires the pound sign and no spaces at the beginning of that line.

Dansguardian uses a 24hour clock. The first line is saying everything in this file only applies from 08:00 to 17:00 on Monday-Friday The last number (01234) is the days of the week this rule applies. 0=Monday 1=Tuesday etc. For every day put 0123456. For  Tuesdays and Thursdays put 13.
The other lines are the domains we want to block between 8 and 5.
TIP: If you want to block all web browsing use ** by itself on a line.

Now this won't do anything until we tell dansguardian to include this in the blacklist. Use the Web GUI to edit the Filter Group 1 site blacklist file and add this line anywhere you want:

A hard restart of Dansguardian should get it working.

If you already use multiple filter groups, you may want to put that .Include line in the site blacklist file for the other groups too.

Warning: If you mess up syntax or get windows line endings in your files, dansguardian may refuse to start. The web gui hides any error messages, so login to ipcop as root and from the command line type dansguardian and look for any error messages.

Note: If you want to allow these sites during lunch hour it gets more complicated. You can NOT put two #time lines in the same file. You have to create two seperate files, one that blocks the sites from 8AM to 11:59AM Monday-Friday, and a second that blocks the same sites from 1PM to 5PM monday-Friday. Include both files in the blacklists for any groups you have.