| # Copyright (c) 2012 The Chromium OS Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| description "D-Bus message bus daemon" |
| author "chromium-os-dev@chromium.org" |
| |
| # Stop conditions for this job deliberately omitted: D-Bus clients |
| # routinely terminate with crashes when dbus-daemon terminates before |
| # them. Ordering process termination with Upstart is hard, so we simply |
| # leave dbus-daemon running to ensure the rest of the system can shut |
| # down cleanly. Also see the post-stop script below that reboots the |
| # system in response to dbus-daemon exiting unexpectedly. |
| start on starting boot-services |
| |
| pre-start script |
| # The following ensures that there is a valid machine-id for dbus and |
| # that it's regenerated on every boot to avoid potential privacy |
| # issues. |
| rm -f /var/lib/dbus/machine-id |
| dbus-uuidgen --ensure |
| end script |
| |
| expect fork |
| exec dbus-daemon --system --fork |
| |
| # Instruct Upstart to establish a connection to the System Bus so that |
| # dbus-send can be used to communicate with it. |
| post-start exec kill -USR1 1 |
| |
| post-stop script |
| # The system is unusable if dbus-daemon crashes; the various daemons |
| # that were connected to it won't re-register their service names, so |
| # they won't be able to talk to each other. Instead of attempting to |
| # respawn dbus-daemon, reboot the system to get back to a sane state. |
| logger -t "$UPSTART_JOB" "dbus-daemon exited unexpectedly; rebooting" |
| uptime_sec=$(awk '{ print $1 }' </proc/uptime) |
| metrics_client -t Uptime.DBusCrash "${uptime_sec}" 1 1000000 50 |
| reboot |
| end script |