WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: dbus reload  (Read 4599 times)

Offline Arslan S.

  • Hero Member
  • *****
  • Posts: 825
dbus reload
« on: July 28, 2012, 02:10:10 AM »
anytime a new dbus conf is installed you need to restart dbus daemon but this way running applications using dbus crash immediately
proper way is to reload dbus configuration instead of restarting it

here is a patch that adds reload function to dbus init script

Code: [Select]
--- dbus 2012-07-28 12:01:24.443430507 +0000
+++ dbus.reload 2012-07-28 11:59:25.430093599 +0000
@@ -20,6 +20,22 @@
  rm /var/run/dbus/pid
 }
 
+reload() {
+
+        if [ -e /var/run/dbus/pid ]; then
+                echo -e "\nReloading D-BUS configuration ... \c"
+                if dbus-send --system --type=method_call \
+                      --dest=org.freedesktop.DBus / org.freedesktop.DBus.ReloadConfig 2>/dev/null; then
+                   echo -e "ok!\n"
+                else
+                   echo -e "failed!\n"
+                fi
+        else
+                start
+        fi
+
+}
+
 status() {
  if [ -e /var/run/dbus/pid ]; then
  echo -e "\ndbus is running.\n"
@@ -39,6 +55,8 @@
  ;;
  restart) stop; start
  ;;
- *) echo -e "\n$0 [start|stop|restart|status]\n"
+ reload) reload
+ ;;
+ *) echo -e "\n$0 [start|stop|restart|reload|status]\n"
  ;;
 esac

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14568
Re: dbus reload
« Reply #1 on: July 28, 2012, 05:06:50 AM »
posted