Running/triggering external processes on certain events
timo-news at tee-en.net
Sun Jan 8 21:54:02 GMT 2006
Has there ever been discussion about possibitily to trigger running some
external administrator-defined processes on certain events that were defined
in a disk share definition?
At least I don't know that Samba would currently provide feature like this.
As an example, you could define:
<other share-spesific stuff>
pre move = /usr/bin/xxx1
post move = /usr/bin/xxx2
post create = /usr/bin/xxxc
pre delete = /us/bin/xxxd
That would run the specified program (xxx1) before moving a file due to user
request, and another one (xxx2) after the move has completed. Similar ones
after file creation, and before file delete.
Actually, the pre-one might be required to return non-fail return value
(that would be based on the arguments passed to the program, in this case
propably file name and new path), in order the move to be done.
Events that could be specified to trigger external processes could include
eg. create, delete, move and copy of a file/directory.
Why am I thinking strange features like this?
As a very simple case, that would allow eg. changing the file group, when a
file is moved under another directory (making it effectively behave like a
As a more complicated case, I'm considering using Samba as a front end
system in an environment, where certain actions should be taken eg. when
workstation applications finish their run (write files). This would be most
practical to process at the (file) server, but writing a daemon to just
watch for new files or other changes on the disk doesn't sound that nice.
For me, that doesn't sound very complicated to implement. I guess the
biggest work would be specifying the required exact syntax, and properly
extracting everything from the smb.conf file.
I haven't even tried to look at sources, to find out how this could be done.
Anyway, I believe it might be a too complicated task for me alone,
especially since it would also require continuos patching of the new
versions of Samba forever in the future in my environment.
If someone more familiar with the Samba code got interested in implementing
this idea in the original Samba source, I'm ready to support the work with a
reasonable contribution to the Samba project.
timo at tee-en.net
FI-00180 Helsinki, Finland
More information about the samba-technical