Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'over,': 0.05; 'operation,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'rename': 0.09; 'subject:python': 0.10; 'subject:file': 0.13; '(say': 0.16; '>after': 0.16; '>of': 0.16; 'bieber': 0.16; 'copied.': 0.16; 'different,': 0.16; 'email addr:ix.netcom.com': 0.16; 'email name:wlfraed': 0.16; 'from:addr:ix.netcom.com': 0.16; 'from:addr:wlfraed': 0.16; 'from:name:dennis lee bieber': 0.16; 'message-id:@4ax.com': 0.16; 'received:wlfraed': 0.16; 'tmp': 0.16; 'url:netcom': 0.16; 'url:wlfraed': 0.16; 'wulfraed': 0.16; 'wed,': 0.17; 'wrote:': 0.18; 'received:166': 0.18; 'subject:skip:s 10': 0.18; 'say,': 0.19; 'url:home': 0.21; 'feb': 0.22; '>the': 0.23; 'creating': 0.25; 'suggestion': 0.26; '+0200,': 0.30; 'lock': 0.30; 'operation.': 0.30; 'yesterday,': 0.30; 'actual': 0.32; 'instead': 0.33; 'file': 0.34; 'header:X -Complaints-To:1': 0.34; 'lee': 0.34; 'directory.': 0.34; 'leaves': 0.34; 'to:addr:python-list': 0.35; 'received:org': 0.36; 'affects': 0.37; 'machine': 0.37; 'charset:us-ascii': 0.37; 'problems': 0.38; 'being': 0.40; 'might': 0.40; 'to:addr:python.org': 0.40; 'more': 0.61; 'your': 0.61; 'taking': 0.66; 'special': 0.66; 'dennis': 0.73; 'physical': 0.79; 'dir,': 0.84; 'ready,': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Dennis Lee Bieber Subject: Re: python file synchronization Date: Wed, 08 Feb 2012 09:53:54 -0500 References: <24cb8965-9211-4601-b096-4bf482aead18@h6g2000yqk.googlegroups.com> <20120208034025.GA14347@cskk.homeip.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: mobile-166-147-103-043.mycingular.net X-Newsreader: Forte Agent 6.00/32.1186 X-No-Archive: YES X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 30 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1328712858 news.xs4all.nl 6855 [2001:888:2000:d::a6]:34379 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:20024 On Wed, 8 Feb 2012 08:57:43 +0200, Sherif Shehab Aldin wrote: > >After searching more yesterday, I found that local mv is atomic, so instead >of creating the lock files, I will copy the new diffs to tmp dir, and after >the copy is over, mv it to actual diffs dir, that will avoid reading It >while It's still being copied. > Are your tmp directory and your "diffs" directory on the same physical volume? If so, "mv" is a rename operation, that only affects the directory information. If the volumes are different, then "mv" reverts to a copy/delete file operation. To avoid problems in the future (say the "diffs" machine is reconfigured with an additional drive and "tmp" is now mounted on the new drive) you might be better off taking part of the suggestion to use a special file name to indicate an "in-work" file... diffs.timestamp.part say, and when ready, just mv diffs.timestamp.part diffs.timestamp This leaves them in the same physical location and directory. -- Wulfraed Dennis Lee Bieber AF6VN wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/