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.
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.
> 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!]
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.
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.