Tiny Core Linux

Tiny Core Extensions => TCE Bugs => Topic started by: Arslan S. on July 28, 2012, 05:10:10 AM

Title: dbus reload
Post by: Arslan S. on July 28, 2012, 05: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
Title: Re: dbus reload
Post by: Juanito on July 28, 2012, 08:06:50 AM
posted