如何指定电源按钮以执行“ shutdown -h now”(而不是图形关闭菜单)?


Answers:


16

这很简单。当您按下电源按钮时,ACPI事件将在触发脚本/etc/acpi/powerbtn.sh

您可以对其进行编辑以shutdown -h now使其首先运行,如下所示:

#!/bin/sh
# /etc/acpi/powerbtn.sh
# Initiates a shutdown when the power putton has been
# pressed.

/sbin/shutdown -h now "Power button pressed"
exit 0

# leave the old code below (in case you want to revert!)

1
将您的答案移至另一个答案,我们可以将其作为重复项关闭。
布鲁诺·佩雷拉

1
同样适用于Ubuntu 12.04和13.10。
elomage 2014年
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.