Neil Parker wrote:

> As mentioned above, a move (rename) is safe.

Neil gave lots of good information.

But remember that the mv command sometimes does a rename, and
sometimes does a copy.  If the destination file is on a different
filesystem than the original, then the file is copied and the original
is deleted, and copying is not an atomic operation.  Here's a safe way
to move the mailbox even across filesystems..

        tmpfile="`mktemp /var/spool/mail/tmpfile.XXXXXXXX`"
        mv /var/spool/mail/bucket "$tmpfile"
        mv "$tmpfile" someOtherFile

By putting tmpfile in the same directory as the original, you ensure
that they're both in the same filesystem, so mv will do an atomic
rename.

Rename is an atomic operation even across NFS, so you're still safe
even if your mailbox is NFS mounted.

-- 
Bob Miller                              K<bob>
kbobsoft software consulting
http://kbobsoft.com                     [EMAIL PROTECTED]

Reply via email to