On 17/01/2008, Paul de Weerd <[EMAIL PROTECTED]> wrote: > On Thu, Jan 17, 2008 at 12:14:59PM +0000, Andreas Kahari wrote: > | The afterboot(8) manual says to use "ln -fs", e.g. > | > | ln -fs /usr/share/zoneinfo/Canada/Atlantic /etc/localtime > | > | That way, the /etc/localtime will never not be there (it will not be > | there for a short time between 'rm' and 'ln -s' if you do it that > | way). > > Sorry, but there will be a short time where the link is not there, > even with ln -sf, there is no way to atomically change a symlink that > I know of. > > From the source (/usr/src/bin/ln/ln.c) : > > /* > * If the file exists, and -f was specified, unlink it. > * Attempt the link. > */ > if ((fflag && unlink(source) < 0 && errno != ENOENT) || > (*linkf)(target, source)) { > warn("%s", source); > return (1); > } > > First unlink(source), then link. It's a short period, but it's not 0. > > Cheers, > > Paul 'WEiRD' de Weerd
Ok, but at least the time will be fair bit shorter... -- Andreas Kahari Somewhere in the general Cambridge area, UK