Running a python program during idle time only

John Abel jabel at plus.net
Fri May 27 04:14:11 EDT 2005


John Abel wrote:

>Shane Hathaway wrote:
>
>  
>
>>Mike Meyer wrote:
>> 
>>
>>    
>>
>>>On a completely different topic, this looks like the wrong way to solve
>>>the problem. You want to update a search engine based on changes to the
>>>underlying file system. The right way to do this isn't to just keep
>>>rescanning the file system, it's to arrange things so that your scanner
>>>gets notified of any changes made to the file system. I did something like 
>>>this for my web site search engine, but that's hooked into the SCM that's
>>>used for propogating changes to the web site. I know someone is working
>>>on patches to the FreeBSD kernel to make this kind of thing work. It would
>>>seem that some of the "backup" facilities that worked by keeping a mirror
>>>of the disk on separate media would have to have used such hooks, but maybe
>>>not.
>>>   
>>>
>>>      
>>>
>>I think you're right that filesystem change notification is what Carlos
>>needs.
>>
>>If you're interested in using Linux, Carlos, "inotify" is a new kernel
>>module that can notify your program of filesystem changes.  It's not
>>folded into the mainline kernel yet, but it's a clean patch.
>>
>>http://www.edoceo.com/creo/inotify/
>>
>>I don't know if Windows has anything like it.  I'd be interested to hear
>>if it does.
>>
>>Shane
>> 
>>
>>    
>>
>Using the PyWin32 extensions, you can register an event with the kernel, 
>and then have the script sleep.  If I can remember how, I'll post some 
>code.  It's been a while since I coded specific Win32 stuff.
>
>J
>  
>
Couldn't find my code, but this page has various ways of doing it on Win32.

http://tgolden.sc.sabren.com/python/win32_how_do_i/watch_directory_for_changes.html

HTH

J



More information about the Python-list mailing list