[Tutor] Watch and control access to an executable
Alan Gauld
alan.gauld at freenet.co.uk
Sat Apr 8 16:51:53 CEST 2006
> > The usual way of doing this is simply to create an empty file
> > when the program starts and delete it when the program closes
> Couldn't this approach cause problems if the Python program crashes,
> leaving behind the empty file?
Yes, but its very easy for the administrator to delete the rogue file.
This is how most Unix tools do it, using /tmp as the storage
folder - /tmp can be purged at each reboot so ensuring a
clean startup. This is simple to manage and better than writing
entries to files which can get corrupted - that's much more
difficult to manage. (This technique is also a mainstay of
Mainframe computing and has been for over 40 years! :-)
> However, there is a Cookbook solution that does,
> I believe, that what the original poster asked:
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/67663
The Mutex version is nice, I haven't seen that before. Although it will only
work on Windows but since that's what the OP uses, it's not a problem.
Alan G.
More information about the Tutor
mailing list