Same files on distinct directory trees
or what I would call File System Views.
So here is the problem.
An application monthly generates a set of files and directories on its own way. I need these files to be accesed readonly from an user (through samba, so file system permissions aren't trouble) on a more friendly way. A simplified example:
The application generates those files:
and I want the user to view something like:
where the relationship between codes and names are known for me.
The application creates new files or overwrites previously generated ones. My target is that the user could access his view of the files so they are the last version generated by the application.
So here is my idea:
Use inotifywait, watching for create events, and execute a script that links the original file to its ubication on the user view as soon as new file is created. This way, the user view is updated almost simultaneously as the files are created and modified (I'm talking about links) by the application while no extra space is required on the server.
So here are my doubts:
┐Is there a more straight and simple solution I'm not aware of?
If my idea feels ok ┐should I use soft or hard links? Files will be on the same filesystem, so I can use hard links. But the application generates also directories that I can't hard link and I will have to traverse source directory making directories and linking files on destination, which could be not so straight.
Thanks in advance.
It seems that my assumption of samba share not affecting at all is far to be true (http://www.samba.org/samba/news/symlink_attack.html).
It's of course a matter of how I organize the files, but to be able to use soft links I must disable [unix extensions] and enable [wide links] directives on samba configuration. So if I want to stick with default samba configuration and consider both Windows and Linux clients, I must use hard links.
On the other side of investigation, I will not need to traverse anything due to the inhability of hardlinking directories. As application generates directories itself and inotify takes account of this, I can make directories as soon as application does. And cp -al comes to the rescue as an one-for-all solution making dirs and linking files as desired.
|All times are GMT -5. The time now is 08:35 PM.|