I want to serve some static files under the directory /var/www
I would like to swap in a new set of files (which exist as, for example, /var/data/example
) every few days or so. The server does not follow symlinks (the host is Linux).
So the curious thing is that when I try a hardlink I get an EPERM:
fs.link('/var/data/example', '/var/www');
This is a bit surprising, since I can create /var/www
. What's more if I do this:
fs.rename(`/var/data/example', '/var/www')
it works! I am mystified by this. I would rather use links, as it allows me to preserve what used to be there, rather than clobbering it.
Does anyone know why this might be happening?
From your example (you didn't explicitely say, but /var/www
is usually a directory, so I take /var/data/example
is too), it seems that your are trying to hard link a directory.
That can't be done on most filesystem (and in particular, can't be done with ext4
, which is the most likely — tho I only guess from heuristic reasonning. /var/www
means unix. Probably linux. So probably ext4
).