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

Shutdown kde correctly from command-line

Tags: None
(comma "," separated)
cz0
Registered Member
Posts
11
Karma
0
Hi, folks!
I'm running KDE 4.3.5. I have session saving while shutting down on, so all my stuff will get back on KDE startup. To terminate KDE session I usually press Control-Alt-Del, so, the session get saved correctly. In that way, to switch off my puter I have to exit from KDE session by pressing Control-Alt-Del and than press power button (so, acpid will do the rest). Is there is a way to exit KDE session correctly, saving it, but using any console command, so I can add it to my acpid rule or to shutdown my station remotely?
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
You need to communicate with KSMServer. Catch is the command must be run as your user, otherwise D-Bus will refuse the message for security reasons, even if the sender is root.

Code: Select all
qdbus org.kde.ksmserver /KSMServer logout 0 0 0


If you wish to instruct KDE to perform a system shutdown ( including proper KDE logout ) run:

Code: Select all
qdbus org.kde.ksmserver /KSMServer logout 0 2 2


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
cz0
Registered Member
Posts
11
Karma
0
That works! But where can I find more information about parameters?
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
More information can be found here: http://majewsky.wordpress.com/2009/07/1 ... om-remote/


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
cz0
Registered Member
Posts
11
Karma
0
hayathms
Registered Member
Posts
1
Karma
0
OS
Beautifull , I was searching for these commands from half a decade.,
martingi
Registered Member
Posts
1
Karma
0
OS
Very useful!

(and all the other stuff one could do with dbus... Controll the network manager and such...)

The commands dont't work as given if I use them from a virtual terminal. But

Code: Select all
DISPLAY=:0 qdbus org.kde.ksmserver /KSMServer logout 0 0 0


does the trick!
mxttie
Registered Member
Posts
10
Karma
0
OS
martingi wrote:Very useful!

(and all the other stuff one could do with dbus... Controll the network manager and such...)

The commands dont't work as given if I use them from a virtual terminal. But

Code: Select all
DISPLAY=:0 qdbus org.kde.ksmserver /KSMServer logout 0 0 0


does the trick!


thanks for this tip! also, you have to run this command under the same user as you are running the kde session
Edit: just read bcooksley already mentioned that :<
jlinkels
Registered Member
Posts
31
Karma
0
OS
Great post! Thanks a lot.

jlinkels


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], kde-naveen, Sogou [Bot], Yahoo [Bot]