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

F

Farraige

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
 
L

Larry Bates

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top