5

My question ( Is there a way to cat files as they are created? ) is marked as a duplicate, but I believe it differs significantly from the indicated question. I've added what I think are redundant explanations as to why I think it is not a duplicate and why the other question didn't even surface as what I was looking for.

The answer to the previous question has a link to inotify-tools that if I had translated "hook to a specific file" to mean "monitor files as they are created" I might have seen as the solution to my problem.

My question here is this: Am I off--base in thinking my question is significantly different and not a duplicate? I think I understand the similarities, but are implicit similarities the equivalent to exact duplicates that any potential user should realize?

Or better yet, is there a way of improving searches so that the other question would at least show up in a search for "do something with files as they are created"? My [duplicate] question is result number 4 for that search and the only one I see that is actually relevant to the search.

7
  • I don't understand, you've accepted an answer using inotify which is the same basic idea as in the dupe. How does your question differ? If you watch a directory, you can cat new files as they are created which is what you seem to want to do.
    – terdon Mod
    Feb 27, 2014 at 14:42
  • 1
    So does every question that could be answered using rsync count as a duplicate of some other question answered with an rsync solution? Feb 27, 2014 at 14:46
  • 1
    Of course not but here, the basic trick is to use inotify which can monitor both files and directories in the same basic way. Also, remember that dupes are not deleted, they act as sign posts to the duplicate.
    – terdon Mod
    Feb 27, 2014 at 14:48
  • @terdon Fair enough, but what would be a better way (or is there a better way) of guiding future information seekers to the aforementioned question? My searches for information on doing something with files as they are created fell short and I am not a novice searcher. Feb 27, 2014 at 14:55
  • 2
    That's what I mean, now, people will find your question, that's the difference between closed and deleted. You're quite right that the link was not evident but thanks to your question, it now will be.
    – terdon Mod
    Feb 27, 2014 at 14:56
  • @terdon this question too - unix.stackexchange.com/questions/117074/…. Monitoring a log is better done through syslog if possible, here I think it would actually benefit from an answer for other syslog implementations.
    – Graeme
    Feb 28, 2014 at 0:25
  • The question has now been reopened and closed as a duplicate of the right one.
    – terdon Mod
    Feb 28, 2014 at 16:58

2 Answers 2

2

I just saw that the question was marked as a duplicate and was just about to post a similar question one here.

No, in my opinion, you are not off-base in thinking that your question is significantly different enough to not be a duplicate. I understand that in many cases where the best answer to a particular question basically boils down to "use this tool" and that there is value in directing all those questions to a single canonical question even if there is some semantic difference in the questions. In fact I myself flagged a question as a duplicate today because ultimately the most viable answer was "use auditd" (for logging all commands).

At the other end of the spectrum there are various tools which are too complex for it to be helpful just to give a answer of "use this tool, here are the basics". There are many examples of this. One which comes up at most, if not every day is usage of sed. There are multiple ways to use this tool, yet many test processing questions (often specifically asking for a sed solution) result in an answer using its replace feature. These are not marked as dupes, and I believe rightly so because this feature is sufficiently complicated that it is unhelpful to point them all to a single "how can I replace text?" question and disallow specific answers.

Another example mentioned by the OP is rsync. There are many nuances to consider when crafting a script to backup files, even if it has already been decided to use a particular tool first. I think it is necessary to consider these questions carefully on their semantics rather than whether they contain "rsync" and "backup".

While usage of inotifywait is considerably less complicated than rsync and sed, I still think there is enough nuance in its usage to warrant different questions answers showing this. For one, the question was about monitoring a directory rather than a specific file. Also in that it required a continuous process rather than the one off process given in the chosen answer to the other question.

The answer I gave I think also adds value in showing inotifywait usage and shell syntax that may not be obvious to a beginner looking to do the same thing. This would be not only irrelevant, but incorrect if used in an answer to the other question. I think the question should ultimately be left open for anyone who comes up with a better idea, as great as I think the answer is :)

From a wider perspective I think this highlights a flaw in the system. Every time someone flags the question as a duplicate, this is a vote to mark it as such. What the system lacks is any way to vote that you don't think this is the case (which would obviously have been my vote). Currently in borderline cases like this, whether or not the question is closed relates more to the volume of traffic it receives. If enough people visit it, then eventually enough will flag it as a duplicate even if the majority of people who look at the duplicate link don't think so. If people can vote both ways, then the result would better reflect the balance of opinion.

Also looking for similar questions to this, it probably wouldn't be unreasonable to mark this one as a dupe... some irony in that I think.

4
  • Graeme I'm quite comforted by the fact that I was not alone in questioning this. I'm reassured by @terdon and his discussion here that regardless, my question and your answer can potentially be of help to future users. Feb 27, 2014 at 17:38
  • @DavidWilkins (and Graeme) personally, I would not have closed that Q but I am happy to leave it closed precisely because Graeme gave you a good answer. I agree that a non-expert (which includes me by the way) could have a hard time translating watching a directory to watching a file but since Graeme showed you how, I feel it is a valid duplicate. Had you not received any answers, I would have voted to reopen.
    – terdon Mod
    Feb 28, 2014 at 0:11
  • 1
    @terdon I think mostly what has happened here is that some of the people who have been here for some time know these questions have been asked before. So it wasn't so much a question of whether it was a dupe, but what it was a dupe of. In this case the one chosen wasn't such a good match. the one mentioned on slm's answer is though.
    – Graeme
    Feb 28, 2014 at 0:20
  • OK, I'll try and get it reassigned.
    – terdon Mod
    Feb 28, 2014 at 0:29
2

If you've frequented the SE sites enough the dups serve a very useful purpose, they are the alternative paths to a singular Q + A's. Jeff Atwood wisely realized this (if you listen to the SE podcasts) and knew that it was impossible to create a rigid structure that would take a questioner to their exact answer, so rather they (Jeff & Joel) opted to provide multiple mechanisms.

  • tags
  • search
  • sorting by votes
  • closed and dups questions
  • FAQ
  • active
  • chatrooms
  • Google

All these mechanisms are like the lines on a road, they're guides, but no single one will always guarantee you a success. So you have to a bit plastic when you're searching for answers to your questions.

Here are some of my general tactics

Rule #1

If you're ever given an error message, search for that within the site. Also search for that error message against the site using Google (site:unix.stackexchange.com "..error msgs")

Rule #2

Play with the words that you're searching for. In your case you locked in on "hook to a specific file". That phrasing to me could be recast as:

  • watch a specific file
  • monitor a specific file
  • watch file
  • monitor file
  • track file

Rule #3

Pivot the searches. I can't tell you how many times I've seen a question where the OP and earlier answers either didn't bother or didn't think to pivot their searches. What do I mean by pivot?

A search is a refinement. Often times it's best to cast a wide net and then "pivot" it on something completely unrelated, such as "user:gilles" or "user:slm" or "user:22565" <--- that's Stephane Chazelas.

But you can also pivot them on other things such as only showing answers, only showing questions etc. etc.

I have more tricks but these basic ones will usually route out 90% of the related Q&A to a phrase.

5
  • I'm confused, so please bear with me...How was I supposed to translate from my question regarding "files as they are created" to "monitor", "watch", or "track" a file? Even if I look for "watch directory" or "monitor directory" I still see nothing close to what I was originally looking for. Feb 27, 2014 at 17:40
  • On the other hand, extrapolating a little... "Check for new files" gives me this as the top result: unix.stackexchange.com/questions/24952/… which, in my opinion, my question is a closer duplicate of... Hindsight being closer to 20/20 and all Feb 27, 2014 at 17:45
  • @David, yeah, that is much closer. I vote that at a minimum we get a mod to change it to that one. I think there is still a good case for yours being different though. The requirement to view contents and the possible race conditions are a significant nuance.
    – Graeme
    Feb 27, 2014 at 18:12
  • @DavidWilkins - those were just suggestions, I hadn't searched any of those. My point was in trying to adjust your search parameters, nothing more.
    – slm Mod
    Feb 27, 2014 at 18:34
  • 1
    @DavidWilkins - also no one here is a god, we are ppl, same as you, trying to manage the site, so it's always best to ask questions, if something isn't clear or is blatantly wrong always pipe up about it, we're all trying to make the body of work here as good as possible!
    – slm Mod
    Feb 27, 2014 at 18:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .