Running/triggering external processes on certain events

tridge at tridge at
Mon Jan 9 02:27:37 GMT 2006


 > This would be a nice feature to implement as a VFS module.

One option that I thought might be nice would be to write a js glue
module for both ntvfs and ldb. That would allow you to write
javascript extensions for both file sharing and databases. 

The ntvfs subsystem would init the js engine when the tree connect is
made, which means no js startup cost on each operation, which should
mean its very fast to hook arbitrary operations. The speed would
really only depend on how complex the js functions are that you
provide for each hook, but it should be much faster than launching an
external program (probably by a couple of orders of magnitude at

This could be used in 2 ways:

 - prototyping extensions which later get re-written in C if they are
   popular and need more speed

 - little extensions written by administrators for things like
   auditing, 'magic' behaviour on particular file types etc.

As we already have a js engine in smbd, it won't add any bloat to
support this. The glue module should be tiny.

You could still call extenal programs from the js script of course,
but at least the logic for deciding when to run the program can be
done in js (for example, via a wildcard match).

Cheers, Tridge

More information about the samba-technical mailing list