Skip to content

Instantly share code, notes, and snippets.

@bool-dev
Forked from whiteley/dbus-init-checkconf.sh
Created January 31, 2014 15:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bool-dev/8734231 to your computer and use it in GitHub Desktop.
Save bool-dev/8734231 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -o errexit
set -o nounset
if [[ ${#} -ne 1 ]]
then
echo "Usage: ${0} upstart-conf-file" >&2
exit 1
fi
config=${1} && shift
dbus_pid_file=$(/bin/mktemp)
exec 4<> ${dbus_pid_file}
dbus_add_file=$(/bin/mktemp)
exec 6<> ${dbus_add_file}
/bin/dbus-daemon --fork --print-pid 4 --print-address 6 --session
function clean {
kill $(cat ${dbus_pid_file})
rm -f ${dbus_pid_file} ${dbus_add_file}
exit 1
}
trap "{ clean; }" EXIT
export DBUS_SESSION_BUS_ADDRESS=$(cat ${dbus_add_file})
/bin/init-checkconf ${config}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment