in reply to Re^2: Monitoring when a file opened
in thread Monitoring when a file opened

I think what really matters in this scenario are the points at which new versions of the file are saved. (Trying to detect when some arbitrary mswin samba client opens the file seems like a much harder problem.)

Suppose you had a continuous process (or a frequent cron job) on the samba server that checked the file's modification time -- e.g. at intervals of 5 sec or less. As soon as the process detects that the file has been modified relative to the previous check, the current version of the file is copied to someplace safe with a distinctive appendage to the file name based on the current system time.

This will drastically reduce the likelihood that the person who saves a new version after a 3-hour (or 3-day) editing session will obliterate other people's changes that were saved during the interim. The probability of two people issuing save commands within the same short interval, though not nil, is perhaps comfortably low. (At least, it'll be a big improvement over the status quo.)

There's still the problem of detecting when two or more successive saves contain divergent changes relative to some earlier version, and then reconciling them. For this, it might suffice if the short-interval "check-for-update" process runs a backtick "diff3" command each time the file is modified, comparing the newest version just detected with the previous two. (I haven't used diff3, but it is a standard GNU utility, and I think it would do nicely for this job.)