Re: Sending session DBus message from system cron job?
On Wednesday 10 March 2010, Glennie Vignarajah wrote:
> Le 09/03/2010 vers 17:49, dans le message intitulé "Sending session
> 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
I'm by now using this method to send a message from a (system) cron job
and unfortunately it does not work as I hoped. I've changed
pgrep -u $USER startkde
to
pgrep startkde
as I want to stop all nepomuk indexers during a backup. However, I get
an error message in the output from the cron job, implying that the
message could not be sent, and indeed, the indexer is not disabled. This
is the message:
Failed to open connection to "session" message bus: Did not receive a
reply. Possible causes include: the remote application did not send a
reply, the message bus security policy blocked the reply, the reply
timeout expired, or the network connection was broken.
Is there a way to work around this?
Michael
--
Michael Schuerig
mailto:michael@schuerig.de
http://www.schuerig.de/michael/
Reply to: