Shutdown Pressing Power Button (简体中文)

From ArchWiki
Revision as of 11:38, 1 September 2008 by GD (Talk | contribs) (使用电源开关关闭系统 moved to 使用电源开关关闭系统 (简体中文): 大量整理条目中……)

Jump to: navigation, search

Template:I18n links start Template:I18n entry Template:I18n entry Template:I18n entry Template:I18n entry Template:I18n links end

Tango-preferences-desktop-locale.pngThis article or section needs to be translated.Tango-preferences-desktop-locale.png

Notes: please use the first argument of the template to provide more detailed indications. (Discuss in Talk:Shutdown Pressing Power Button (简体中文)#)

如果你想按下电源开关就可以关闭系统,可以按以下方法来做:

安装acpid软件包,将acpid加入到rc.conf的DAEMONS队列中(并且/或者执行/etc/rc.d/acpid start),然后在/etc/acpi/events/中创建一个文件,内容如下:

# /etc/acpi/events/power
# This is called when the user presses the power button

event=button/power (PWR.||PBTN)
action=/sbin/poweroff

现在开始,按下电源开关(轻按,而不是长按几秒)就可以正常关闭系统了。 要注意,如果你已经正确配置好休眠(hibernate),你也许想将最后一行换为:

action=/usr/sbin/hibernate

无论如何,如果你使用更复杂的窗口管理器(WM),你应该使用它自己的关机调用,使得它可以进行保存会话等工作。

KDE中,可将action变为:

action=/opt/kde/bin/dcop --all-users --all-sessions ksmserver ksmserver logout 0 2 0

而对于XFCE4.4则变为:

action=echo POWEROFF | /usr/lib/xfce4/xfsm-shutdown-helper


注意:要更稳健的解决方案[If you are facing frequent WM crashes or working on a sacrificial PC for developing or testing your software...],你可以参阅"/usr/src/linux/Documentation/sysrq.txt", which is a kernel facility for yielding you [the user...] the CPU so that it could be used for any *rescue* work.