2003-10-14 Havoc Pennington <hp@redhat.com>
[platform/upstream/dbus.git] / bus / messagebus.in
index 60c7077..7a35876 100755 (executable)
@@ -7,7 +7,7 @@
 #               and other messages. See http://www.freedesktop.org/software/dbus/
 #
 # processname: dbus-daemon-1
-# pidfile: @EXPANDED_LOCALSTATEDIR@/messagebus.pid
+# pidfile: @DBUS_SYSTEM_PID_FILE@
 #
 
 # Sanity checks.
 # Source function library.
 . @EXPANDED_SYSCONFDIR@/rc.d/init.d/functions
 
+# so we can rearrange this easily
+processname=dbus-daemon-1
+servicename=messagebus
+
 RETVAL=0
 
 start() {
     echo -n $"Starting system message bus: "
-    daemon dbus-daemon-1 --system
+    daemon --check $servicename $processname --system
     RETVAL=$?
     echo
-    [ $RETVAL -eq 0 ] && touch @EXPANDED_LOCALSTATEDIR@/lock/subsys/messagebus
+    [ $RETVAL -eq 0 ] && touch @EXPANDED_LOCALSTATEDIR@/lock/subsys/$servicename
 }
 
 stop() {
     echo -n $"Stopping system message bus: "
-    killproc messagebus
+
+    ## we don't want to kill all the per-user $processname, we want
+    ## to use the pid file *only*; because we use the fake nonexistent 
+    ## program name "$servicename" that should be safe-ish
+    killproc $servicename -TERM
     RETVAL=$?
     echo
     if [ $RETVAL -eq 0 ]; then
-        rm -f @EXPANDED_LOCALSTATEDIR@/lock/subsys/messagebus
+        rm -f @EXPANDED_LOCALSTATEDIR@/lock/subsys/$servicename
+        rm -f @DBUS_SYSTEM_PID_FILE@
     fi
 }
 
@@ -45,7 +54,7 @@ case "$1" in
         stop
         ;;
     status)
-        status messagebus
+        status $processname
         RETVAL=$?
         ;;
     restart)
@@ -53,13 +62,13 @@ case "$1" in
         start
         ;;
     condrestart)
-        if [ -f @EXPANDED_LOCALSTATEDIR@/lock/subsys/messagebus ]; then
+        if [ -f @EXPANDED_LOCALSTATEDIR@/lock/subsys/$servicename ]; then
             stop
             start
         fi
         ;;
     reload)
-        killproc messagebus -HUP
+        echo "Message bus can't reload its configuration, you have to restart it"
         RETVAL=$?
         ;;
     *)