See when process exits in Windows XP
Brad Tilley
rtilley at vt.edu
Sat Oct 16 22:52:58 EDT 2004
I've tested this function out and it works well... it'll loop until
ntbackup.exe has exited and then the script goes on to rename the
backup.bkf file and copy it to a file server. Having _never_ done this
before I thought it'd be wise to run this by comp.lang.python. I know
it's a simple and stupid way in which to monitor a process, but it works
for me... is it safe to do this? I don't want to get too complex.
Thanks, Brad
def wait_for_ntbackup_to_exit(procname):
while True:
try:
pids = win32pdhutil.FindPerformanceAttributesByName(procname)
if len(pids) > 0:
print pids
print len(pids)
print "ntbackup is running... waiting for it to exit."
continue
except:
return
More information about the Python-list
mailing list