This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Remote shutdown KDE with qdbus

Tags: None
(comma "," separated)
sgofferj
Registered Member
Posts
31
Karma
0
OS

Remote shutdown KDE with qdbus

Sun Sep 14, 2014 5:07 pm
Hi,

under Opensuse I had a script to shutdown my desktop machine remotely by ssh'ing to the machine and executing my script:

Code: Select all
#/bin/bash
export DISPLAY=:0
qdbus org.kde.ksmserver /KSMServer logout 0 2 2


However, under kubuntu, I get

Code: Select all
Could not connect to D-Bus server: org.freedesktop.DBus.Error.NoServer: Failed to connect to socket /tmp/dbus-yjs7O10zzS: Connection refused


Any ideas on that?

-S
luebking
Karma
0
try
Code: Select all
export $(tr '\0' '\n' < /proc/$(ps -Ao %p%c | sed '/ksmserver/!d; s/ *\([0-9]*\) *.*/\1/g')/environ | grep DBUS_SESSION_BUS_ADDRESS)


resp.
Code: Select all
ADDRESS="$(tr '\0' '\n' < /proc/$(ps -Ao %p%c | sed '/ksmserver/!d; s/ *\([0-9]*\) *.*/\1/g')/environ | grep DBUS_SESSION_BUS_ADDRESS |  cut -d"=" -f2-)"
qdbus --address "$ADDRESS" ...
sgofferj
Registered Member
Posts
31
Karma
0
OS

Re: Remote shutdown KDE with qdbus

Sun Sep 14, 2014 8:29 pm
Perfect, thanks!


Bookmarks



Who is online

Registered users: bartoloni, Bing [Bot], Evergrowing, Google [Bot], q.ignora, watchstar