summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndraž Levstik2009-02-28 15:50:28 +0100
committerAndraž Levstik2009-02-28 15:50:28 +0100
commit3cc87d8a7c7905024fdf966d2c7d08907b70c2bf (patch)
treec9d8b3cbdb1d857937c89903f0cac4443aaadf67
parent3c905614442f5f6bca61beade7c3b98ea4ab972d (diff)
dbus: updated init script to be more resiliant to bad shutdowns
-rw-r--r--utils/dbus/HISTORY6
-rwxr-xr-xutils/dbus/init.d/smgl-messagebus29
2 files changed, 25 insertions, 10 deletions
diff --git a/utils/dbus/HISTORY b/utils/dbus/HISTORY
index 494867a06a..83e0b489d2 100644
--- a/utils/dbus/HISTORY
+++ b/utils/dbus/HISTORY
@@ -1,3 +1,9 @@
+2009-02-28 Andraž "ruskie" Levstik <ruskie@mages.ath.cx>
+ * init.d/smgl-messagebus: made it more resiliant and actually
+ fail if it can't start instead of always succeeding and thus
+ blocking hal indefinetly like I had happen quite a few times
+ on bad shutdowns
+
2009-01-10 Vlad Glagolev <stealth@sourcemage.org>
* FINAL: added, for the notes about the non-DEish WMs
diff --git a/utils/dbus/init.d/smgl-messagebus b/utils/dbus/init.d/smgl-messagebus
index 073f159ef5..fbc4551a3f 100755
--- a/utils/dbus/init.d/smgl-messagebus
+++ b/utils/dbus/init.d/smgl-messagebus
@@ -3,6 +3,7 @@
PROGRAM=/usr/bin/dbus-daemon
ARGS="--system"
RUNLEVEL=3
+NEEDS="+remote_fs"
PIDFILE=/var/run/dbus/pid
. /etc/init.d/smgl_init
@@ -10,17 +11,25 @@ PIDFILE=/var/run/dbus/pid
start() {
echo "Starting system message bus..."
mkdir -p /var/run/dbus
- if test ! -f $PIDFILE; then
- # don't use loadproc here, as that fails if some user is running
- # a session bus
- $PROGRAM $ARGS
- evaluate_retval
- echo "Creating dbus machine uuid..."
- /usr/bin/dbus-uuidgen --ensure
- evaluate_retval
- else
- print_status warning "$PIDFILE exists, messagebus is running or has crashed"
+ # make sure there is actually a process there...
+ if [ -f $PIDFILE ]; then
+ echo "Found $PIDFILE doing extra checks..."
+ if ! ps ax | grep "dbus-daemon" | grep -q $(cat /var/run/dbus/pid) ; then
+ print_status warning "$PIDFILE exists, but messagebus is not running under this PID"
+ echo "Attempting cleanup and new startup..."
+ rm -f $PIDFILE
+ else
+ echo "Seems to be running..."
+ return 0
+ fi
fi
+ # don't use loadproc here, as that fails if some user is running
+ # a session bus
+ $PROGRAM $ARGS
+ evaluate_retval
+ echo "Creating dbus machine uuid..."
+ /usr/bin/dbus-uuidgen --ensure
+ evaluate_retval
}
stop() {