Results 1 to 6 of 6

Thread: OS File System Hooks?

  1. #1

    Default OS File System Hooks?


    I would like to run a script upon the creation of a directory with a particular name. While I could use 'find' or 'locate' on a cron that seems rather inefficient. Is there a way to 'hook' into the creation of a file or directory with a script?

    I think there must be a way since 'locate' keeps its database up to date all the time.

    I'm running OpenSuSE 11.0.


  2. #2

    Default Re: OS File System Hooks?

    inotify-tools should do the job... inotify-tools looks like pacman has it.
    Man first, have a try at Info, have a look at Wiki, if all that fails Scroogle!!!!!
    If I've helped click on the Rep button I don't know what it does but it sounds cool.

  3. #3

    Default Re: OS File System Hooks?

    Very cool, thanks.

    It will allow me to make sure .svn directories have svn:svn ownership when created by other programs. E.g., during a checkout from an application like Aptana.

    Just thought I would mention this in case anyone else comes across the same requirement and does a search.

  4. #4
    palladium NNTP User

    Default Re: OS File System Hooks?

    > I think there must be a way since 'locate' keeps its database up to
    > date all the time.

    as far as i know 'locate' keeps its db up to date using 'updatedb'
    being triggered by a [default] once a day cron....

    have you changed yours to an "all the time" cron...wouldn't that cause
    a huge resources hit and drag your system down? [of course, your
    system might be strong enough to do it constantly...mine would not be!]


  5. #5

    Default Re: OS File System Hooks?

    I've done nothing special with updatedb but locate seems to be up to date without me ever running updatedb so I just figured the SuSE people did something extra that is perhaps not so easy to find in the documentation.

    In my case if it was on a cron, as long as it wasn't being run too often it probably wouldn't slow me down too much with a quad core 2.6 GHz processor. I find the quad core pretty much keeps the system smooth even when some process sucks up 100% of one of the cores on a thread and I have never seen Linux allow something to push more than one thread to 100% (although I am sure it is possible).

    Usually they all just sit there and fluctuate between 1% - 10% usage or less if I close the system monitor and use something text only like htop.

  6. #6

    Default Re: OS File System Hooks?

    It seems to me that the use of groups and sticky bits (i.e. chmod) on the parent directory where files and directories are created might be a simpler solution.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts