WatchDirectory home page
WatchDirectory Startseite (Deutsche Version)
Site WatchDirectory (Français)
  Welcome, Guest. Please Login or Register
YaBB - Yet another Bulletin Board
   
  HomeHelpSearchLoginRegister  
 
Page Index Toggle Pages: 1
LFTA plugin for watchdirectory (Read 2335 times)
jdijk
YaBB Newbies
*
Offline



Posts: 1
LFTA plugin for watchdirectory
Apr 23rd, 2009 at 7:41pm
 
Dear Watchdirectors  Wink

here a small contribution in the form of a plugin to the community.

we found watchdirectory very usefull to assist in filetransfers between systems.
but the problem was that it can be that multiple processing systems are looking in folders for files
and these systems can either pick up or process these files.

now watchdirectory can assist very good with its possible settings to detect if the file is still in use or growing.
but it does not provide out of the box a mechanism to do the same for the destination.
it can be that a process on the destination will try to grab the file, while its still being filled.
i know systems at the "other side" should also do "intelligent checks" but sometimes you do not have this under your control.

therefor we move/transfer files allways in a certian way.

1 (lock) rename from source\file.txt to source\file.txt.lck
2 copy source\file.lck to destination\file.lck
3 verify or md5sum the source\file.lck with destination\file.lck
5 (unlock) rename destination\file.txt.lck to destination\file.txt
6 if needed archive the source\file.lck to archive\file.txt
7 remove souce\file.txt.lck

and if on any in these steps strange things or errors occure, then it will mail snmptrap log and stop processing the file.

This we call the (L)ocked (F)ile (T)ransfer method.

the attached zip file:

name:lfta-1.4.8.zip
md5:4a9f11a8bbb6aaa2221343d19a8df79e

contains a template for watchdirectory and the lfta.cmd plugin

with this plugin you can monitor a folder an run this script with three command arguments

var1: SCRIPT / TEST
var2: Destination folder for the file
var3: Destination archive folder or NOARCHIVE to disable the archive usage.

it will then copy and archive the file with the above named lfta method.

you can enable or disable md5 and sending email.
the script only uses (if enabled) external commands for these functionalities (md5 and sending email)
its disabled by default so dont forget to enable it inside the script preferences.

more readme and help and a screenshot is in the file

best advantage of the script is that  if you supply unc or paths you can see all the supplied command arguments from the task and browse them from there. also nice is you can use this and supply the destination from the gui and manage it all from there.
(if you use scripts ofcource, otherwise you would need to supply destinations in your scripts etc)

let me know if anyone really finds this usefull for its own usage.

With kind regards,

Jan Dijk

ps: this script can also be a script template for any other run script in watchdirectory if you need to log and error handle things.
a nice batch tutorial to fiddle with Smiley

changelog 1.4.7 - 1.4.8 : added logfile and logpath checks

syntax test on commandline:
lfta.cmd TEST c:\temp c:\temp\archive d:\temp "test file.txt"

logfile output example:
2009042490115: (START):looking up "d:\temp\test file.txt"
2009042490115: (LOCK):Rename "d:\temp\test file.txt" to "d:\temp\test file.txt.lck"
2009042490115: (COPY):Copy "d:\temp\test file.txt.lck" to "c:\temp\test file.txt.lck"
2009042490115: (MD5COPY):Md5sum "d:\temp\test file.txt.lck" and "c:\temp\test file.txt.lck"
2009042490116: (UNLOCK):rename "c:\temp\test file.txt.lck" to "c:\temp\test file.txt"
2009042490116: (ARCHIVE):Copy "d:\temp\test file.txt.lck" to "c:\temp\archive\test file.txt"
2009042490116: (MD5ARCHIVE):Md5sum "d:\temp\test file.txt.lck" and "c:\temp\archive\test file.txt"
2009042490116: (DELSOURCE):deleting "d:\temp\test file.txt.lck"
2009042490117: (END):Transfer Completed Successfully.
Back to top
« Last Edit: Apr 24th, 2009 at 10:04am by jdijk »  

lfta-1_4_8.zip (31 KB | )
 
IP Logged
 
Gert
YaBB Administrator
*****
Offline



Posts: 2225
The Netherlands
Re: LFTA plugin for watchdirectory
Reply #1 - Apr 24th, 2009 at 8:06am
 
Thanks Jan.

I will certainly look over the script to see if I can re-use some of your ideas.

The normal "copy files" and "sort files" plugins use the default Windows copy mechanism. I dont have a reason to believe they are not reliable. However, as you told me earlier by email, I can understand that Banks need to implement things "extra securely".

I wonder if other customers would like to have this kind of functionality build-into the "copy files" plugin.

Anyway, thanks again.
Gert
Back to top
 

Gert Rijs - gert (at) gdpsoftware (dot) com
Blog: http://blog-en.gdpsoftware.com/
End Alzheimer's: http://www.alz.org&&...
WWW WWW GdPSoftware  
IP Logged
 
Page Index Toggle Pages: 1