I use the icon in the upper right corner of GNOME Shell to shut down my system.

Which command is used to shutdown the system?

  • halt
  • shutdown -h now
  • Something completely different?

enter image description here

  • which version - gnome 3.16? You may get an idea of which bit to look at from the code of this extension (which works on 3.14 and earlier...) – Wilf May 30 '15 at 17:58
  • EDIT: much better extension to examine, as it can replace the shutdown button (albeit with a suspend button) - gnome probably uses a backend, or system call (or something...) to tell the system to shutdown - extensions can to some extent execute commands, though privileged shutdown ones may cause issues. What problems if any make you need to do this? – Wilf May 30 '15 at 18:14
  • @Wilf I do not want to install an extension. I want to intervene in the existing system. – A.B. May 31 '15 at 18:21
  • 1
    I think that the command used is a message to dbus. The problem is that it changes with gnome versions and underneath system and so on. Maybe ubuntuforums.org/showthread.php?t=1660987 can help. You can use vidner.net/martin/software/dbus-spy to see what's happening... – Rmano Jun 2 '15 at 17:51
  • 1
    @Rmano This is an interesting approach. – A.B. Jun 2 '15 at 18:09

The command used to shutdown is:

dbus-send --system --print-reply --dest=org.freedesktop.login1 /org/freedesktop/login1 "org.freedesktop.login1.Manager.PowerOff" boolean:true

For understanding

man systemd-logind

systemd-logind is a system service that manages user logins. It is
       responsible for:

       ·   Keeping track of users and sessions, their processes and their idle

       ·   Providing PolicyKit-based access for users to operations such as
           system shutdown or sleep

       ·   Implementing a shutdown/sleep inhibition logic for applications

       ·   Handling of power/sleep hardware keys

       ·   Multi-seat management

       ·   Session switch management

       ·   Device access management for users

       ·   Automatic spawning of text logins (gettys) on virtual console
           activation and user runtime directory management

Now read to the systemd/logind wiki http://www.freedesktop.org/wiki/Software/systemd/logind/

  • It's possible to change this command? – A.B. Jun 8 '15 at 16:34
  • @A.B. :Why need to change? – Erkin Alp Güney Jun 16 '15 at 6:25
  • @ErkinAlpGüney Just for fun =) – A.B. Jun 16 '15 at 7:19

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.