Please help to update the following script:
/var/squid/install/run/share/htdocs/vbox/proxy/commander/updatebl.sh
At this moment, this script will remove the existing one and replace it totally with the new one.
And we want: 1. after downloaded the blacklist, it will extract the tar.gz. it will put the file in /var/squid/tmp/blacklists/blacklists.tar.gz
2. then it will only update the categories directory exist in both
/var/squid/install/run/etc/dansguardian/blacklists_dir/blacklists/ and
/var/squid/tmp/blacklists/blacklists/ If you have any problem on it, please let me know.
updatebl.sh:
1. the function of the updatebl.sh
Compared the date of with the date of local file blacklists.info,if the date is same ,then there is no need update blacklists of local。else it will download new blacklists from and then append to local blacklists.so that keep local blacklists is new all the time.
2. expected result of it
The content of local blacklists is local existed blacklists added new blacklists that donwload from website.
3. usage of it
usage: ./updatebl.sh
#!/usr/bin/perl
$blaklists="/var/squid/install/run/etc/dansguardian/blacklists_dir/blacklists"; opendir (DIR,"$blacklists")or die "can't open $blacklists:$!\n"; foreach $dir(readdir DIR){ if ($dir ne "." && $dir ne ".."){ #print "$dir:\n";
opendir (ADS,"$blacklists/$dir")or die "can't open $dir:\n"; foreach $file(readdir ADS){
if($file eq "urls"){ #print "$dir/$file\n";
#print "$dir have urls\n";
last; } if($file eq "." && $file eq "..") { next; } #print "touch file: $dir/$file\n";
system "touch $blacklists/$dir/urls"; } close ADS;} } close DIR;
|
阅读(285) | 评论(0) | 转发(0) |