Sunday, 15 September 2013

linux - How to make tail wait for files to be created before tailing them -


I'm trying to find a way to wait for files to create tail Start presenting them. For example, suppose I have a log directory that has not yet been created, but my application will create it. Suppose I have another process in which I would like to run tail -f logs / * .log and all files are created like that, they should begin to run.

And secondly: if tail is removing some files that have been deleted, then it is possible to start it again, if it is ?

With some roughness, it works:

  Inotifywait -q .; Kill $ PID; Tails-F-N * 0 * PID = $!!   

Anything in any directory change, the tail command restart.

No comments:

Post a Comment