f1fc
![]() |
|
|
|
|
|||||||
| General General questions about the FreeBSD operating system. Ask here if your question does not fit elsewhere. |
![]() |
|
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
Is there a way to monitor my filesystem without polling every second?
I'am lookling for a way to watch for new files under some directory and watch for file changes, and it should be a real-time solution. It seems to me, that kqueue is the key to this, but I haven't found a program in ports that could do file monitoring this way. Also a related question on tail. When tail is invoked like this Code:
tail -f some_file |
|
#2
|
|||
|
|||
|
tail uses kqueue to do the job. Take a look at the code in usr.bin/tail/forward.c. Specifically look at the code in the follow and set_events subroutines.
|
| The Following User Says Thank You to gordon@ For This Useful Post: | ||
lokli (November 1st, 2009) | ||
|
#3
|
|||
|
|||
|
thanks, it seems tail is what i really need.
i'am writing something like a wrapper to irc/ii for personal use so, i'am trying to make tail read the "out" files Code:
tail -F some_file [another_file] Code:
tail -F */out is there a way to add new files to a running instance of tail? P.S. i'am still interested in directory monitoring using kqueue |
|
#4
|
|||
|
|||
|
The problem is likely due to shell globbing. Assuming that */out doesn't match any files, the shell will pass it as is to the tail process. As a result, tail is attempting to open a file named "*/out" which is unlikely to work. I suppose an enhancement could be made to tail to do the globbing, but I would be concerned about the performance impact of such a change. I also don't know if kqueue/kevent would work with globs (I somehow doubt it).
|
|
#5
|
|||
|
|||
|
"tail -F */out" find files, that already present.
my point is that i want to monitor files, that are not present yet. for example i can issue Code:
tail -F some_channel/out Quote:
i haven't found a way to look for changes in real time, so i just look for them every 10 seconds via shell script. |
|
#6
|
|||
|
|||
|
Quote:
Code:
tail -F foo/out bar/out To see what I'm talking about, try running tail -F */out and then run ps in another window. You should see the arguments expanded instead of */out. |
| The Following User Says Thank You to gordon@ For This Useful Post: | ||
lokli (November 3rd, 2009) | ||
|
#7
|
|||
|
|||
|
You can use sysutils/wait_on for monitoring directories/files.
Last edited by DutchDaemon; November 8th, 2009 at 18:48. |
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [Solved] Network monitoring tool | wonslung | Networking | 9 | December 16th, 2010 06:32 |
| Monitoring Bandwidth | atwinix | Networking | 4 | October 14th, 2009 00:06 |
| Free Space Monitoring Script | naezdnik | Userland Programming & Scripting | 6 | October 7th, 2009 12:14 |
| Statistics Monitoring | mikej83 | General | 2 | August 16th, 2009 23:08 |
| Serious network monitoring tool | Mad_Dud | Networking | 2 | April 25th, 2009 20:34 |