You are not logged in.

#1 2009-12-31 20:32:18

pogeymanz
Member
Registered: 2008-03-11
Posts: 1,020

What is a nice way to shutdown in a WM?

I always just run

sudo shutdown -h now

But then some of my running apps freak out and leave errors (that I can see for a few moments after X dies but before it shuts down) along the lines of "Holy crap: can't find screen 0, OMG crash dead"

Is there a smarter way to shutdown? Maybe a script that sends sigterm calls to all running programs first?

Offline

#2 2009-12-31 20:37:43

Lich
Member
Registered: 2009-09-13
Posts: 437

Re: What is a nice way to shutdown in a WM?

Exit your WM then shutdown (be it via a desktop manager or a terminal)
My login drops me to a shell so I exec `startx` manually. When I'm done I just exit ratpoison then do a `shutdown -h now`


Archlinux | ratpoison + evilwm | urxvtc | tmux

Offline

#3 2009-12-31 20:51:08

pogeymanz
Member
Registered: 2008-03-11
Posts: 1,020

Re: What is a nice way to shutdown in a WM?

Lich wrote:

Exit your WM then shutdown (be it via a desktop manager or a terminal)
My login drops me to a shell so I exec `startx` manually. When I'm done I just exit ratpoison then do a `shutdown -h now`

Yeah, but doesn't logging out from your WM upset your apps?

For example, Claws-mail and Pidgin sit in my system tray. When I shutdown (or just logout my WM) I see errors that they leave. They're obviously trying to draw themselves, but since X is no longer running they just error out.

Offline

#4 2009-12-31 20:59:51

Lich
Member
Registered: 2009-09-13
Posts: 437

Re: What is a nice way to shutdown in a WM?

pogeymanz wrote:
Lich wrote:

Exit your WM then shutdown (be it via a desktop manager or a terminal)
My login drops me to a shell so I exec `startx` manually. When I'm done I just exit ratpoison then do a `shutdown -h now`

Yeah, but doesn't logging out from your WM upset your apps?

For example, Claws-mail and Pidgin sit in my system tray. When I shutdown (or just logout my WM) I see errors that they leave. They're obviously trying to draw themselves, but since X is no longer running they just error out.

Well of course the apps would crash, but that shouldn't matter...Doubt there's one person here that has a perfect setup, and no errors. FFS, I get errors all the time...even when starting X. Just warnings..nothing too bad. If pidgin crashes, it also disconnects and the tray exits, it's not clean, but they do close. I wouldn't worry too much about this.

Last edited by Lich (2009-12-31 22:49:07)


Archlinux | ratpoison + evilwm | urxvtc | tmux

Offline

#5 2009-12-31 22:27:09

Crows
Member
From: Wales
Registered: 2008-09-05
Posts: 92

Re: What is a nice way to shutdown in a WM?

Same. I doubt even gnome/kde stop all their processes completely without error (I could be wrong though). Something like pidgin shouldn't ever break from being killed. Don't worry about it.

That said, I do tend to shut down any apps like firefox before I shutdown. That's just me though. Nothing to worry about.

Offline

#6 2009-12-31 22:33:33

ataraxia
Member
From: Pittsburgh
Registered: 2007-05-06
Posts: 1,553

Re: What is a nice way to shutdown in a WM?

I just close everything by hand and then shutdown in a terminal.

Offline

#7 2009-12-31 23:06:48

teh
Member
From: Tijuana, Mexico
Registered: 2009-07-07
Posts: 374
Website

Re: What is a nice way to shutdown in a WM?

I use 'h' alias for 'halt'.


arst

Offline

#8 2010-01-01 00:11:54

some-guy94
Member
Registered: 2009-08-15
Posts: 360

Re: What is a nice way to shutdown in a WM?

I use

 dbus-send --system --print-reply --dest="org.freedesktop.Hal" /org/freedesktop/Hal/devices/computer org.freedesktop.Hal.Device.SystemPowerManagement.Shutdown

to shutdown instead of using sudo

Offline

#9 2010-01-01 00:12:38

linkmaster03
Member
Registered: 2008-12-27
Posts: 269

Re: What is a nice way to shutdown in a WM?

I have Super+Shift+Grave bound to `sudo poweroff`.

Offline

#10 2010-01-01 00:17:42

anonymous_user
Member
Registered: 2009-08-28
Posts: 3,059

Re: What is a nice way to shutdown in a WM?

@some-guy94 - thats interesting. Is there a similar command for rebooting?

Offline

#11 2010-01-01 03:26:22

some-guy94
Member
Registered: 2009-08-15
Posts: 360

Re: What is a nice way to shutdown in a WM?

anonymous_user wrote:

@some-guy94 - thats interesting. Is there a similar command for rebooting?

Yeah, there are also commands for hibernate and suspend.
I found it here.

EDIT: I might as well just post them here smile

Reboot
dbus-send --system --print-reply --dest="org.freedesktop.Hal" /org/freedesktop/Hal/devices/computer org.freedesktop.Hal.Device.SystemPowerManagement.Reboot

Shutdown
dbus-send --system --print-reply --dest="org.freedesktop.Hal" /org/freedesktop/Hal/devices/computer org.freedesktop.Hal.Device.SystemPowerManagement.Shutdown

Hibernate
dbus-send --system --print-reply --dest="org.freedesktop.Hal" /org/freedesktop/Hal/devices/computer org.freedesktop.Hal.Device.SystemPowerManagement.Hibernate

Suspend
dbus-send --system --print-reply --dest="org.freedesktop.Hal" /org/freedesktop/Hal/devices/computer org.freedesktop.Hal.Device.SystemPowerManagement.Suspend int32:0

Last edited by some-guy94 (2010-01-01 03:29:02)

Offline

#12 2010-01-01 06:27:06

securitybreach
Member
From: In front of my computers
Registered: 2007-11-18
Posts: 416
Website

Re: What is a nice way to shutdown in a WM?

some-guy94 wrote:

Yeah, there are also commands for hibernate and suspend.
I found it here.

Very nice set of commands. Nice find!!!

Last edited by securitybreach (2010-01-01 06:27:39)


"Every normal man must be tempted at times to spit upon his hands, hoist the black flag, and begin slitting throats." -- H.L. Mencken
Website      Configs
Forum Admin: Bruno's All Things Linux   
securitybreach<a>archlinux.us

Offline

#13 2010-01-01 07:04:36

tomd123
Developer
Registered: 2008-08-12
Posts: 565

Re: What is a nice way to shutdown in a WM?

some-guy94 wrote:
anonymous_user wrote:

@some-guy94 - thats interesting. Is there a similar command for rebooting?

Yeah, there are also commands for hibernate and suspend.
I found it here.

EDIT: I might as well just post them here smile

Reboot
dbus-send --system --print-reply --dest="org.freedesktop.Hal" /org/freedesktop/Hal/devices/computer org.freedesktop.Hal.Device.SystemPowerManagement.Reboot

Shutdown
dbus-send --system --print-reply --dest="org.freedesktop.Hal" /org/freedesktop/Hal/devices/computer org.freedesktop.Hal.Device.SystemPowerManagement.Shutdown

Hibernate
dbus-send --system --print-reply --dest="org.freedesktop.Hal" /org/freedesktop/Hal/devices/computer org.freedesktop.Hal.Device.SystemPowerManagement.Hibernate

Suspend
dbus-send --system --print-reply --dest="org.freedesktop.Hal" /org/freedesktop/Hal/devices/computer org.freedesktop.Hal.Device.SystemPowerManagement.Suspend int32:0

What's the difference between these and just doing sudo shutdown -h now? Can anyone give me one actual example? (I'm asking anyone who knows)

Last edited by tomd123 (2010-01-01 07:05:06)

Offline

#14 2010-01-01 07:13:34

kgas
Member
From: Qatar
Registered: 2008-11-08
Posts: 718

Re: What is a nice way to shutdown in a WM?

This thread gives a good solution for the shutdown/reboot etc options those who are using no DE.

Offline

#15 2010-01-01 09:02:54

onearm
Member
From: Anywhere but here
Registered: 2006-07-06
Posts: 359
Website

Re: What is a nice way to shutdown in a WM?

I use in acpi/events/power:

event=button/power.*
action=/sbin/shutdown -h now

and then just pressing the power off button will suffice


To get something done, a committee should consist of no more than three persons, two of them absent.
--
My Github

Offline

#16 2010-01-01 09:59:37

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

Re: What is a nice way to shutdown in a WM?

securitybreach wrote:
some-guy94 wrote:

Yeah, there are also commands for hibernate and suspend.
I found it here.

Very nice set of commands. Nice find!!!

I don't see anything nice here. It's sending request to the (widely hated and soon deprecated) HAL. I'd rather trust sudo.


This silver ladybug at line 28...

Offline

#17 2010-01-01 10:27:10

Wintervenom
Member
Registered: 2008-08-20
Posts: 1,011

Re: What is a nice way to shutdown in a WM?

A window manager-agnostic session manager that could signal processes to gracefully exit when logging off, shutting down, or rebooting would be nice...

Last edited by Wintervenom (2010-01-15 02:53:35)

Offline

#18 2010-01-01 10:52:07

cwjiof
Member
From: Taichung, TW
Registered: 2008-01-27
Posts: 131

Re: What is a nice way to shutdown in a WM?

I prefer pressing the power button.
http://wiki.archlinux.org/index.php/Shu … wer_Button

Offline

#19 2010-01-01 21:27:12

Dieter@be
Forum Fellow
From: Belgium
Registered: 2006-11-05
Posts: 2,001
Website

Re: What is a nice way to shutdown in a WM?

nothing wrong with a `shutdown -h now` afaik.
of course your apps will lose the connection to X when it shuts down. but that's normal. and all your programs will get a sigterm anyway.
it's not like your apps will start removing files or writing other crap to your hard disk when the connection to X drops/they get sigterm.
(if they do, that's a bug in those apps ;-)

and "just close your WM and do a shutdown after that" brings no advantages, it's just a manual step more, but the same things happen.


< Daenyth> and he works prolifically
4 8 15 16 23 42

Offline

#20 2010-01-01 21:59:08

some-guy94
Member
Registered: 2009-08-15
Posts: 360

Re: What is a nice way to shutdown in a WM?

lolilolicon wrote:
securitybreach wrote:
some-guy94 wrote:

Yeah, there are also commands for hibernate and suspend.
I found it here.

Very nice set of commands. Nice find!!!

I don't see anything nice here. It's sending request to the (widely hated and soon deprecated) HAL. I'd rather trust sudo.

Well I have found equivalent commands with devicekit-power/upower for suspend and hibernate.
Suspend
dbus-send --system --print-reply --dest="org.freedesktop.DeviceKit.Power" /org/freedesktop/DeviceKit/Power org.freedesktop.DeviceKit.Power.Suspend

Hibernate
dbus-send --system --print-reply --dest="org.freedesktop.DeviceKit.Power" /org/freedesktop/DeviceKit/Power org.freedesktop.DeviceKit.Power.Hibernate

EDIT:
I have found commands that use consolekit for restarting/shutting down, so no more HAL.
Shutdown
dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Stop

Reboot
dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Restart

Last edited by some-guy94 (2010-01-01 22:20:46)

Offline

#21 2010-01-01 22:05:19

Dieter@be
Forum Fellow
From: Belgium
Registered: 2006-11-05
Posts: 2,001
Website

Re: What is a nice way to shutdown in a WM?

some-guy94 wrote:
lolilolicon wrote:
securitybreach wrote:

Very nice set of commands. Nice find!!!

I don't see anything nice here. It's sending request to the (widely hated and soon deprecated) HAL. I'd rather trust sudo.

Well I have found equivalent commands with devicekit-power/upower for suspend and hibernate.
Suspend
dbus-send --system --print-reply --dest="org.freedesktop.DeviceKit.Power" /org/freedesktop/DeviceKit/Power org.freedesktop.DeviceKit.Power.Suspend

Hibernate
dbus-send --system --print-reply --dest="org.freedesktop.DeviceKit.Power" /org/freedesktop/DeviceKit/Power org.freedesktop.DeviceKit.Power.Hibernate

I second what lolicon (or whatever) said. but s/(widely hated and soon deprecated) HAL/bloated incomprehensible dbus/


< Daenyth> and he works prolifically
4 8 15 16 23 42

Offline

#22 2010-01-01 22:35:25

deadlylife
Member
Registered: 2008-12-24
Posts: 120

Re: What is a nice way to shutdown in a WM?

I just open a terminal (ctrl+alt+home on my PC) and type "sudo init 0"

Offline

#23 2010-01-02 03:57:22

r6
Member
From: Melbourne
Registered: 2008-07-02
Posts: 156

Re: What is a nice way to shutdown in a WM?

I've always typed sudo halt and sudo reboot, but now I've chmod u+s /sbin/shutdown and made some keybindings to shutdown -h now and shutdown -r now.

Offline

#24 2010-01-02 11:31:47

PirateJonno
Forum Fellow
From: New Zealand
Registered: 2009-04-13
Posts: 372

Re: What is a nice way to shutdown in a WM?

r6 wrote:

I've always typed sudo halt and sudo reboot, but now I've chmod u+s /sbin/shutdown and made some keybindings to shutdown -h now and shutdown -r now.

It's probably safer to add an entry to /etc/sudoers, so that arbitrary users can't shutdown. For example:

<USER> ALL=NOPASSWD: /sbin/shutdown

But even better IMHO are the consolekit ones, because you get extra protection from e.g. shutting down with other users logged on


"You can watch for your administrator to install the latest kernel with watch uname -r" - From the watch man page

Offline

#25 2010-01-02 13:24:03

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 4,092
Website

Re: What is a nice way to shutdown in a WM?

pogeymanz wrote:

Some of my running apps freak out and leave errors (that I can see for a few moments after X dies but before it shuts down) along the lines of "Holy crap: can't find screen 0, OMG crash dead"

Is there a smarter way to shutdown? Maybe a script that sends sigterm calls to all running programs first?

Are you looking for behavior more similar to Windows? I mean, when you tell the computer to shutdown, it first asks all the applications to quit. If an application doesn't want to close yet, (for example, if there is a popup asking if you want to save an unsaved document) then the OS will wait until the application is finished closing. Is that what you are looking for?

I'm sorry, I don't know of a way to do that in Linux. I really like the way Linux handles shutting down though. When I tell it to shutdown now, it shuts down now! big_smile This way, the computer is doing exactly what I tell it to do, instead of what the software wants to do. I just close all of applications first, including any web browsers and IM clients.

I'm sorry if I misunderstood your question.

Offline

Board footer

Powered by FluxBB