0

I am trying to use monit to monitor and automatically issues like crashes, memory leaks and cpu hotspinning.

For one application - one that uses DBus (serving and calling funcs) just will not start.

It uses GDBus which errors with dbus-launch not availiable – which indeed is true as the targets system is quite oldish and there that command does not exist yet exist.

But running the binary from console works - just works - I guess this is because of DBUS_SESSION_BUS_ADDRESS is set properly - but this is not the case in the shell being spawned for monit?

How can I make the shell spawned by monit aware of a shell variable (i.e. DBUS_SESSION_BUS_ADDRESS)?

drahnr
  • 380

1 Answers1

0

It seemed to be security feature - this git commit resolves the issue by not trashing the env array.

https://bitbucket.org/tildeslash/monit/issue/6/dbus-session-bus


A dirty workaround for those stuck to monit 5.4 or earlier (last tested):

A dirty hack to get a session bus from other processes env variables (only tested with a single user):

#! /bin/sh
DBUS_ADDRESS=`grep -z DBUS_SESSION_BUS_ADDRESS /proc/*/environ 2> /dev/null| sed -e 's/\/proc\/[^\/]*\/environ\:/ /g'| cut -d ' ' -f 2`
if [ "x${DBUS_ADDRESS}" != "x" ]; then
        export ${DBUS_ADDRESS}
fi
drahnr
  • 380