[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Sending session DBus message from system cron job?



Le 09/03/2010 vers 17:49, dans le message intitulé "Sending session DBus 
message from system cron job?", Michael Schuerig(Michael Schuerig 
<michael@schuerig.de>) a écrit:



Hello,


> I'd like to disable the desktop search indexer while the cron-triggered
> backup is running. I've figured out the relevant DBus messages I need
> for that:

I use this code:

-------------
 for _PID in $(pgrep -u $USER startkde) ; do
    _ID="$(cat /proc/$_PID/environ | tr '\0' '\n' |awk -
FDBUS_SESSION_BUS_ADDRESS= '/DBUS_SESSION_BUS_ADDRESS=/ {print $2}')"
    _DBUS_BUS_ADDRESS="$_ID $_DBUS_BUS_ADDRESS"
  done
---------------
In order to find DBUS sockets, and then

---------------
for _BUS_ID in $_DBUS_BUS_ADDRESS ; do
	DBUS_SESSION_BUS_ADDRESS=$_BUS_ID dbus-send --type=method_call --
dest=org.kde.screensaver /ScreenSaver org.freedesktop.ScreenSaver.Lock
done

---------------
in order to lock all my kde sessions.

I don't if this is better, with this methode, there is no need to "su" and 
you're immune to stalled sockets in /tmp/.X11-unix/.

HTP,


-- 
http://www.glennie.fr
If the only tool you have is hammer, you tend to see every problem as a nail.


Reply to: