Linux - GeneralThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Is it possible to make a program that would react on any UNIX file system modification, i.e. whenever some file is created, deleted or changed? Could it be possible to intercept a signal whenevr one of these three actions has happened?
I am sure it is possible, I am not a programmer, or at least C that is, just some webdesign, but I see how something like that could be possible.
But wouldn't it require the program to constantly scan the filesystem for changes??? Maybe someone else wounld know.. Probably get a quicker response in the Programming Forum.
As far as i know, a program like that does not have to check the system constantly. I dont really know how to do it, or the steps on how to do it with C, but i wrote a similar program for windoze with Java (actually we did it with my bro).
It is true that we could scan permanently on UNIX the file system in order to see the differences between the "old" and the "new" state. Then we can conclude what are the files created, modified and deleted. The problem is that this is a very slow method. Searching/scanning the file system costs too much (of time units).
The best solution would be to intercept the eventual signals sent by UNIX kernel whenever a file is created, deleted or modified. This would be a very fast way to get the information. The problem for me is that I do not know if such a signals exist, and if it is the case, if we can catch such a signals by our user program?!
I think you should look at interupt handling. If you watch the interupt for the hard drive(s) then you can tell when it is accessed and don't need to monitor the file system. I don't know how you could distinguish reads from writes using this method.
do users connect to the computer remotely using ftp, ssh or telnet? If thats the case (maybe) you could get the commands from the ftp, ssh, or telnet server and do whatever you want with them. I dont know if you can do that though.
And looking at the old state and the new state of the computer would decrease your computers usage. Its not a big deal with linux (i mean not as much as windows) but it is still a concern.
you need to check out the www.enlightenment.org website - the efsd component of the desktop shell uses a program called fam and a kernel patch called imon to keep on top of file system changes. this is probably what you're looking for. www.whoop.org - this is the website of the guy who's writing efsd.
oss.sgi.com/projects/fam - the sgi site for fam and imon. they're both still in early development.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.