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.)


In reply to Re^3: Monitoring when a file opened by graff
in thread Monitoring when a file opened by Angel

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.