[Scottish] How to avoid symlinks spiralling out of control?

Colin McKinnon scottish at mailman.lug.org.uk
Wed Mar 19 09:18:00 2003


David Marsh's list-reading hat wrote:

>Hmm, I thought I'd be clever and try to backup my critical (but not
>secret) config files onto my webspace.
>
>I use sitecopy to update my website, which is nice and easy and just
>(usually) does the right thing for uploading only files which have
>changed locally.
>
>So, I figured, I'll create a directory to store the parts of /etc that I
>want to have backups of. And then I'll create symlinks for the parts of
>/etc that I want to backup, eg  ln -s /etc/apache .  which gives me a
>symlink to the directory where the apache config files live.
>
>Unfortunately, there's a problem here:
>
>Within /etc/apache/, there is a symlink
>conf -> ./
>and when sitecopy encounters this, it just keeps looping around here,
>creating nested 'conf' directories for some reason.
>  
>
For a very good reason - it is following the symlink. This looks like a 
bit of a fudge, although I'm not sure what the problem was that this is 
intended to fix! Wouldn't it just be simpler to have a single directory 
structure within /etc/apache e.g.:
    cd /etc/apache
    rm conf
    mkdir conf
    mv *.?* conf
    # then check for any files left over - on my machine I also have a 
file called 'magic'
    mv magic conf

...and if something needs the files in /etc/apache, symlink the 
individual files back into that dir.

Colin
(who wrote PushSite  - far superior to sitecopy ;)
((although it wouldn't like that symlink either))