[python-win32] (no subject)

walou c.walou at laposte.net
Fri Nov 12 16:48:34 CET 2004


I forgot to precise that the samba server doesn't wait for the
registry to be modified because it's launched with an "at now".

Le ven 12/11/2004 à 16:16, walou a écrit :
> Thanks for your quick answer, I've thought a little more about it and
> ftp, ssh, and other external methods can't be used. Our servers are
> installed by teachers, or other tech assistants and we don't have any
> control on the server's accounts. So we have to use a built-in method to
> transfert files. XML-RPC should be a good solution.
> 
> About the problem about registry modification, we've used a brutal
> method. ;-)
> 
> user open a session on XP, samba preexec sends the remote registry
> function to the NT service which loops 300 times (2/10 seconds
> interval). The samba server doesn't wait for the registry to be
> modified, continue its process, user gets his registry hive, loop's
> still runing and can now modify the registry.
> 
> I hope that one day we'll write a dll that gets the "open session" event
> and does the process cleanly.
> 
> Klaas T.
> 
> Le ven 12/11/2004 à 15:44, Tim Golden a écrit :
> > [walou]
> > | Hello,
> > | In order to automatically update our NT service, we need to transfert
> > | some files or a zipped file from the server to the clients.
> > | My idea is to create a function that launches an other program which
> > | would stop the service, update it and start it.
> > | Have somebody already done that sort of update ? What's the 
> > | best way to
> > | transfert files ?
> > 
> > I haven't done this myself, but it looks like a case for WMI.
> > Maybe something like the following (completely untested):
> > 
> > <code>
> > 
> > import wmi
> > import win32file
> > 
> > clients = ["W001", "W002", "W003"]
> > 
> > for client in clients:
> >   c = wmi.WMI (client)
> >   for s in c.Win32_Service (Name='MyService'):
> >     s.StopService () # or PauseService etc.
> >     # Use whatever method to copy the file, eg
> >     win32file.CopyFile ("info.dat", r"\\%s\share\info.dat" % client)
> >     s.StartService () # or ResumeService etc.
> > 
> >   print client, "updated successfully"
> > 
> > </code>
> > 
> > Obviously, this is the barebones framework; you need exception
> > checking, possibly threads depending on how many clients you
> > have etc.
> > 
> > As to what file transfer is best, I'd use a straight Win32 copy
> > unless you had some performance or security-related reason not
> > to. Then you could look in to ssh-based methods (scp, sftp, whatever)
> > but there tend to be fewer implementations of these in Win32.
> > 
> > TJG
> > 
> > ________________________________________________________________________
> > This e-mail has been scanned for all viruses by Star. The
> > service is powered by MessageLabs. For more information on a proactive
> > anti-virus service working around the clock, around the globe, visit:
> > http://www.star.net.uk
> > ________________________________________________________________________
> > _______________________________________________
> > Python-win32 mailing list
> > Python-win32 at python.org
> > http://mail.python.org/mailman/listinfo/python-win32
> 
> _______________________________________________
> Python-win32 mailing list
> Python-win32 at python.org
> http://mail.python.org/mailman/listinfo/python-win32



More information about the Python-win32 mailing list