[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: trigger external program on some change

On Thu, 02 Aug 2007, Pierangelo Masarati might have said:

> matthew sporleder wrote:
> >On 8/1/07, Emmanuel Dreyfus <manu@netbsd.org> wrote:
> >>Hello
> >>
> >>I'd need to trigger execution of an external shell script when some
> >>particular change occur in the tree. Is there a simple way of doing that?
> >>
> >>Of course, an overlay could do that. I saw no available overlay that
> >>would have this capacity out of the box. The only way I see is building
> >>a new overlay just for that, or use something such as slapo-auditlog
> >>and feed it to an external filter (throug a pipe?). I wonder if there is a
> >>simplier mechanism available.
> >
> >Although I kind of think a custom overlay would be cleaner, you could
> >try replicating to a dummy server (like localhost:<off port>) running
> >back-shell or back-perl and simply trigger there.
> An alternative could be to use the slapo-accesslog(5) to log write 
> operations, and use slapd-perl(5) as the logging database, so that write 
> operations can be easily intercepted by a scripting backend without the 
> hassle of setting up a replica.
> Note that I haven't tried it, although it __should__ work.
> p.

If there is sufficient logging turned on, another approach is to watch
$host:/var/log/messages for the event.