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.
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.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
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?
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.