views:

17

answers:

1

Hi,

I need to back up some large files that are being written to disk by a process. The process is perpetually running, and occasionally dumps large files that need to be moved over the network. Having the process do this itself is not an option, as the process locks out users whilst it is doing file dumps.

So, this runs under a windows machine, and as a primarily linux user, I am not entirely certain how to do this...

Under linux I would simply use a cron job in the folder (I know the glob that will match the output files), then check lsof, to ensure that the file is not being written to, such that I don't try to copy a partially complete file. Data integrity is critical, so I would normally md5 the files before and after the copy.

So I guess my question is -- how does one do this sort of stuff under windows? I feel like I am kneecapped from the start -- I can use python, but I can't emulate lsof, nor cron to do the task scheduling.

I tried looking at "handle" -- but it needs admin privelidges at execution time, which is also not an option. I can't run the backup process as an admin, it has to run with user privs.

Thanks..

Edit: I just realised I could keep the python instance running, with a sleep, so task scheduling is not a problem :)

A: 

For replacing cron you can use the "Task Scheduler" in windows to start your script every few minutes (or specific times).

For lsof the question was discussed here : http://stackoverflow.com/questions/15708/lsof-equivalent-for-windows

Loïc Février
The only recommendation was handle. the others are interactive and thus not helpful. cheers for the task scheduler tip
SomeoneLikeMe
Or you can go the more "hacky" way : check the file size hasn't changed in the last 60 seconds or so....not very good but should do the job if you don't have any other solution.Or ask the process to launch an other program that will transfer the files.
Loïc Février
yes, I have ended up md5-ing the files... waiting 60 seconds, then doing it again and comparing the hashes
SomeoneLikeMe
How big are the files, md5 is fast enough ?
Loïc Février