Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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)?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

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


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}
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.