"If it was FTP it would be easy, but I don't know how to do it via HTTP."

Wget?
http://www.interlog.com/~tcharron/wgetwin.html

That's what we use to update several files that we use, especially Sniffer
(Declude external test).
Below is a modified version of the batch file we use to update Sniffer.  It
creates a log, and emails the results of the update to an address you
specify.  It uses WGET, and it also uses BLAT to email the results.  Both
WGET and BLAT must be in your path.  

Note that this first changes into the Imail directory, tries to dl the file
(up to 3 times), renames your current file to .old, then renames the .new
file, then restarts the services.

This way, if there is a problem with the new file, you can quickly go back
to your previous file.

Blat can be found here:
http://www.blat.net




----------BEGIN Batch-------

M:
cd Imail

set RETRY=1
goto Start

:Start

:: If we have retried 3 times already, notify via email that the download
failed.

if %RETRY%==4 goto Donebad
echo ---------Download attempt %RETRY%--------->>bl_update.log
wget http://www.vantekcommunications.com/spam/url-domain-bl.txt -O
url-domain-bl.txt.new --cache=off --timeout=60

:: If that worked, then there will be a url-domain-bl.txt.new file.

if exist url-domain-bl.txt.new goto Donegood

:: If the above test fails, then we increment the retry counter and try
agein
:: and take no further action. Everything stays as it is.

set /a RETRY=%RETRY% + 1
goto Start

:: If the test didn't fail we'll replace our file.

:Donegood

echo %date%  %time%: Successfully downloaded url-domain-bl.txt.new after
%RETRY% attempt(s)>> bl_update.log
if exist url-domain-bl.old del url-domain-bl.old
rename url-domain-bl.txt url-domain-bl.old
rename url-domain-bl.txt.new url-domain-bl.txt
echo %date%  %time%: File "url-domain-bl.txt" Replaced Successfully >>
bl_update.log
blat sendgood.txt -s "[Blacklist updated successfully]" -t
[EMAIL PROTECTED] -hostname url-bl.taisweb.net

::Restart the services to make the new list take effect

NET STOP SMTPD32
NET STOP QueueMgr
NET START SMTPD32
NET START QueueMgr

exit



:Donebad

:: If things went well we're all ok.
:: If something went wrong then we'll do a bit of cleanup.

echo %date%  %time%: Download FAILED!! >> bl_update.log
echo %date%  %time%: FILE "url-domain-bl.txt" NOT REPLACED! >> bl_update.log
blat sendbadl.txt -s "[Blacklist download FAILED!]" -t [EMAIL PROTECTED]
-hostname url-bl.taisweb.net
exit

:: Comment out the following pause when you are sure things are working!

pause
----------END Batch---------



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Joe Wolf
Sent: Wednesday, July 07, 2004 10:24 PM
To: [EMAIL PROTECTED]
Subject: Re: [IMail Forum] Ipswitch's URL Blacklist

Thanks for the info but I don't use ColdFusion.  I tried using the VB script
and then copying the file to a different name, but it's still formatted
incorrectly.

I really like William's list and will try and find some reasonable way to
automate the download on a weekly basis that results in a usable file.

If it was FTP it would be easy, but I don't know how to do it via HTTP.

-Joe
----- Original Message -----
From: "Matt Robertson" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, July 07, 2004 7:27 PM
Subject: Re: [IMail Forum] Ipswitch's URL Blacklist


> I had the same problem and, if you're using ColdFusion, the code right
> after my sig will fix it.
>
> The file is, at a guess, not in Windows format.  What I did was read
> it, the put it into server memory and write it all over again.  The
> way CF writes the file makes Imail happy.  The whole routine takes
> about 5 seconds to run and I'm certain with only a little more effort
> I can build it differently so the lines aren't written one at a time
> like this.  Still, it runs fast enough that I'm happy for now.
>
> This routine also adds in my own blacklist entries, which, since I
> rely on an external system, is a mighty short list.  Still if you use
> CF you can use this as the basis to build your own supplementer.  It
> doesn't bother with a dupe check as, again, I only have a few entries.
>
> -- 
> --Matt Robertson--
> MSB Designs, Inc.
> mysecretbase.com
>
> <cfset destinationPath="d:\foo\imail\">
> <cfhttp
> url="http://www.vantekcommunications.com/spam/url-domain-bl.txt";
> method="GET"
> path="#destinationPath#"
> file="url-domain-bl.txt"
> resolveurl="false"
> useragent="mysecretbase.com Imail AntiSpam"
> timeout="45"
> port="80">
> <cfscript>
> /*
>  since my blacklist is pretty short, I can just build it
>  into an array right here.  Make the first element in the
>  array a newline.  In the future I can just add elements
>  to this array to build my own blacklist.
> */
> myBlackList=ArrayNew(1);
> myBlackList[1]="chtah.com";
> myBlackList[2]="dailyinbox.com";
> myBlackList[3]="fsonline.com";
> myBlackList[4]="top-sites.com";
> myBlackList[5]="sheck-buy.com";
> myBlackList[6]="hotproductoutlet.com";
> myBlackList[7]="fbnsvr.com";
> myBlackList[8]="funbenefits.com";
> myBlackList[9]="tamsmtp.net";
> myBlackList[10]="tam10.com";
> myBlackList[11]="nj45.com";
> myBlackList[12]="erationalnews.com";
> myBlackList[13]="host59.erationalnews.com";
> myBlackList[14]="mail.erationalnews.com";
> </cfscript>
> <!--- 
> insert a wait of 1 second to make sure the file has time
> to write itself to disk.
> --->
> <cfset createObject('java','java.lang.Thread').sleep(1000)>
> <!--- 
> read the blacklist file back so we can loop over it
> --->
> <cffile
> action="read"
> file="#destinationPath#url-domain-bl.txt"
> variable="theBlackList">
> <!--- 
> wipe the original file (!)
> --->
> <cffile
> action="write"
> file="#destinationPath#url-domain-bl.txt"
> output=""
> addNewLine="no">
> <!--- 
> loop over the imported file, one line at a time
> --->
> <cfloop
> list="#theBlackList#"
> index="FileItem"
> delimiters="#chr(13)##chr(10)#">
> <!--- 
> Write it to disk all over again, one line at a time
> I should probably try just writing it in one shot.
> --->
> <cffile
> action="append"
> file="#destinationPath#url-domain-bl.txt"
> output="#FileItem#"
> addNewLine="Yes">
>
> </cfloop>
> <!--- 
> loop over the list and append it to the blacklist
> --->
> <cfloop
> from="1"
> to="#ArrayLen(myBlackList)#"
> index="TheEntry">
> <cffile
> action="append"
> file="#destinationPath#url-domain-bl.txt"
> output="#MyBlackList[TheEntry]#"
> addNewLine="Yes">
> </cfloop>
> <html><head><title></title></head>
> <body>Done</body></html>
>
> To Unsubscribe: http://www.ipswitch.com/support/mailing-lists.html
> List Archive: http://www.mail-archive.com/imail_forum%40list.ipswitch.com/
> Knowledge Base/FAQ: http://www.ipswitch.com/support/IMail/
>


To Unsubscribe: http://www.ipswitch.com/support/mailing-lists.html
List Archive: http://www.mail-archive.com/imail_forum%40list.ipswitch.com/
Knowledge Base/FAQ: http://www.ipswitch.com/support/IMail/


To Unsubscribe: http://www.ipswitch.com/support/mailing-lists.html
List Archive: http://www.mail-archive.com/imail_forum%40list.ipswitch.com/
Knowledge Base/FAQ: http://www.ipswitch.com/support/IMail/

Reply via email to