I am extending snmpd with the
extend directive to call some scripts for some OIDs. The script itself calls a custom helper program that gets extracts some value. The helper runs fine when it is started manually from the command line, but when I call it in the script it does not work because it cannot find our custom dependencies in
/cots/boost-1.55/lib. I have added
/etc/ld.conf.d/cots.conf and after running
ldconfig verified that the boost libraries are in the cache. The script basically contains
result=`callHelper with arguments` echo $result
and the result is captured by snmpd and returned. When I query the OID I get an error that it cannot find the external boost library.
I was able to make it work by calling
su user in the script
result=`su user "callHelper with arguments"` echo $result
Can anybody explain why the ld cache is correct when using
su, but not when the script the program directly? I think it has something to do with the fact that snmpd is a system service and thus the environment is different, but
ldconfig is not part of the environment.