I'm building an RPM to install my plugin into the Nagios plugin directory (i.e. /libexec) and also append the appropriate lines into commands.cfg and localhost.cfg to 'activate' it. So far, it works great for the former, but not the latter.
What I have so far is a script in %post that essentially does this:
Code: Select all
%post
if [ $1 -eq 1];
then
if [ -w /path/to/commands.cfg];
then
echo "define command {
#<etc etc, insert command definition stuff here>
}" >> commands.cfg
else
echo "failure to add command defintion"
fi
fi
And it's similar to that for the appropriate lines for localhost.cfg as well. However, when I install the rpm, the plugin is there in /libexec, but nothing happens with regards to the .cfg files.
Has anyone tried something like this before?