LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 11-24-2011, 08:17 AM   #1
0p3r4t4
LQ Newbie
 
Registered: Oct 2008
Posts: 8

Rep: Reputation: 0
Question 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:

app/<code1>/y2010/m05/file1
app/<code2>/y2010/m05/file1

and I want the user to view something like:

user/y2010/m05/<name1>/file1
user/y2010/m05/<name2>/file1

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.
 
Old 11-25-2011, 05:01 AM   #2
0p3r4t4
LQ Newbie
 
Registered: Oct 2008
Posts: 8

Original Poster
Rep: Reputation: 0
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.
 
  


Reply

Tags
filesystems, hard links, inotify, samba



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Merge directory trees mrwall-e Linux - Software 5 02-20-2011 08:37 AM
mkisofs and preserving directory trees crontab Linux - Software 2 03-27-2009 10:00 AM
LXer: Protecting directory trees with gpgdir LXer Syndicated Linux News 0 04-25-2008 12:20 AM
Q: on deleting directory trees n00bJoe Arch 3 03-09-2006 12:13 PM
How to keep 2 directory trees synchronised? hrr Linux - General 2 07-02-2003 12:01 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 11:51 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration