Keywords: developers

# Building Bacula Plugins

There is currently one sample program example-plugin-fd.c and one working plugin bpipe-fd.c that can be found in the Bacula src/plugins/fd directory. Both are built with the following:

     cd <bacula-source>
     ./configure <your-options>
     make
     ...
     cd src/plugins/fd
     make
     make test

After building Bacula and changing into the src/plugins/fd directory, the make command will build the bpipe-fd.so plugin, which is a very useful and working program.

The make test command will build the example-plugin-fd.so plugin and a binary named main, which is build from the source code located in src/filed/fd_plugins.c.

If you execute ./main, it will load and run the example-plugin-fd plugin simulating a small number of the calling sequences that Bacula uses in calling a real plugin. This allows you to do initial testing of your plugin prior to trying it with Bacula.

You can get a good idea of how to write your own plugin by first studying the example-plugin-fd, and actually running it. Then it can also be instructive to read the bpipe-fd.c code as it is a real plugin, which is still rather simple and small.

When actually writing your own plugin, you may use the example-plugin-fd.c code as a template for your code.