Chinaunix首页 | 论坛 | 博客
  • 博客访问: 485004
  • 博文数量: 279
  • 博客积分: 4467
  • 博客等级: 上校
  • 技术积分: 2830
  • 用 户 组: 普通用户
  • 注册时间: 2007-04-03 14:43
文章分类

全部博文(279)

文章存档

2013年(1)

2012年(39)

2011年(35)

2009年(29)

2008年(131)

2007年(44)

分类:

2008-07-01 10:27:46

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;


阅读(280) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~