如何指定电源按钮来执行’shutdown -h now’而不是图形关机菜单?

我想指出当我按下笔记本电脑中的电源按钮时,会发送’shutdown -h now’命令,而不是调出图形关机菜单。 我怎么能在Ubuntu 11.10上做到这一点?

这很简单。 当您按下电源按钮时,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!)