how to force a python service to reconfigure itself after updating?

Larry Bates lbates at swamisoft.com
Fri Apr 9 10:40:17 EDT 2004


You could move the reading of the configuration
file inside the loop so it is read each time
the service wakes up.  Unless your configuration
file is huge (10,000+ lines), the overhead is
negligible.

The other alternative is to put a socket server
inside the service and have a small external
program to send something to it when it needs
to reread the config file.

Regards,
Larry Bates
Syscon, Inc.


"Farraige" <farraige at interia.pl> wrote in message
news:c548h3$8gh$1 at nemesis.news.tpi.pl...
> Hi!
>
> I hope you will help me. I have the following problem....
> I have implemented a Windows NT service using win32serviceutil. The
service
> runs a 'working loop' in another thread and waits for the stop event to be
> set. A working loop thread checks the space used by logfiles against the
> given upper limit and deletes the files, if the upper limit is reached.
> After each space analysis it sleeps for about 30 minutes. The service
> handles start/stop/restart/.../update parameters from the command line.
> Update command updates by default all the changes made in the service
python
> code without need to restart the service... What about the situation if my
> service reads some configuration datas from its config file? If I change
> some data in the configuration files, those changes "will not be seen"
after
> using update parameter due to none change was made in the service code. Do
> you have an idea how to overload the standard behaviour of using update
> command line parameter to force the service to reconfigure itself without
> restarting? I don't now how to implement communication between the main
> function that handles all command (thanks to
> win32serviceutil.HandleCommandLine) line parameters and the working thread
> that is started by the service in its SvcRun method?
>
> Thanks in advance for any hints!
>
> Best wishes,
>
> Niki
>
>





More information about the Python-list mailing list