Thanks Odhiambo ,for this solution , however this will i be ending up in two diffrent cache . Is there any way i can achive this in one squid config file . regards, Shekhar On Wed, Feb 18, 2009 at 9:03 PM, Odhiambo Washington <odhiambo@xxxxxxxxx> wrote: > On Wed, Feb 18, 2009 at 5:14 PM, Shekhar Gupta <shekharsahab14@xxxxxxxxx> > wrote: >> >> Hi , >> >> I am not able to see any configuration where i can use time and delay >> pool to restrict the bandwidth . I am looking for delay pool >> configuration which will restrict the download starting from morning >> 10 am to 6 pm with 10 Kbps and after 6 pm it should allow unlimited >> bandwith . >> >> If any one can please put down this requirment into a config code >> which i can use in my squid . > > It's simple. Just have two files: squid.conf-restricted and > squid.conf-unrestricted > Use cron to rotate the files and restart squid: > Create a file change-squid-settings.sh which looks like this: > > #!/bin/sh > > # Script to change squid between restricted (work hours) and unrestricted > (non-work hours) > > SQUID_CTL=/usr/local/bin/squid > SQUID_HOME=/etc/squid/ > UNRESTRICTED_FILE=$SQUID_HOME/squid.conf-no-restrict > RESTRICTED_FILE=/$SQUID_HOME/squid.conf-restrict > > # See how we were called. > case "$1" in > restrict) > # Lock access to facebook.com, etc > [ -f $RESTRICTED_FILE ] && /bin/cp -f $RESTRICTED_FILE > $SQUID_HOME/squid.conf > $SQUID_CTL -k reconfigure > echo -n ' squid reconfigured to restrict mode ' > ;; > unrestrict) > # Allow access to all shit:-) > [ -f $UNRESTRICTED_FILE ] && /bin/cp -f $UNRESTRICTED_FILE > $SQUID_HOME/squid.conf > $SQUID_CTL -k reconfigure > echo -n ' squid reconfigured to no_restrict mode ' > ;; > *) > echo "Usage: `basename $0` {restrict|unrestrict}" >&2 > exit 64 > esac > > > Now, all you have to do is to invoke this script at 09:59 with > change-squid-settings.sh restrict > > Then at 15:59 you invoke it with: > change-squid-settings.sh unrestrict > > I hope that gives you a clue. > If you find that "-k reconfigure" doesn't start squid properly (with the new > settings), then you may as well use kill or shutdown and then start squid > afresh. > > I used to use Daemontools for SQUID_CTL and I'd simply use "svc -h squid" > and it worked. I hope reconfigure should be equivalent. > > At least you get the idea, right? There are other ways, but this is how I > did mine. > > > -- > Best regards, > Odhiambo WASHINGTON, > Nairobi,KE > +254733744121/+254722743223 > _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > "The only time a woman really succeeds in changing a man is when he is a > baby." > - Natalie Wood >