[Twisted-Python] filewatch.py

Jason Mobarak jason.mobarak at gmail.com
Mon Dec 20 17:43:02 EST 2004


The initializer TimerService will return a TimerService object, which
has the .startService() and .stopService(). So, bind the object
returned by TimerService to some name and call methods on that to
start/stop the service.


On Mon, 20 Dec 2004 14:30:07 -0800, Don Smith <donwsmith at gmail.com> wrote:
> Greetings!
> 
> I'm fairly new to Twisted, but I like it already. However, I'm having
> some difficulty with the filewatch.py example.
> 
> Actually, I extended it to loop over a list of files and start service
> for each. The log files in the list are actually commands to determine
> the most recent log file.
> 
> But I have a condition where the log files will get rotated
> unexpectedly. I would like to re-evaluate my list of log files every
> 120 seconds. I have figured out a method to accomplish this, but it
> just adds the new log files to the service. This is bad. I want to
> stop service on all log files, then start service on the new ones.
> This is what I can't figure out how to do. How do I stop the service?
> 
> This is how I start it:
> if os.path.exists(logfile):
>                 internet.TimerService(0.1, watch2,
> file(logfile),logfile).startService()
> 
> Thanks for you help!!
> 
> Don Smith
> 
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
> 


-- 
Jason




More information about the Twisted-Python mailing list