Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm on Debian-Lenny.

I want to change the action taken by the system when the power button is pressed. How do I modify the system such that it does not power off when it gets an Power Button ACPI event?

(My server is in my room, and I don't want my girlfriend to power off my server by pressing the physical power button.)

How can I achieve that?

share|improve this question

migrated from serverfault.com Jan 25 '11 at 19:07

This question came from our site for professional system and network administrators.

7  
Upgrade your girlfriend to a geek model. Seriously, just talk to her ;) –  MikeyB Jan 25 '11 at 17:15
2  
(I know this is meta, but to the people voting for close - this is a great example of a question that can be rewritten to be more generic and applicable to anyone running a Linux server.) –  MikeyB Jan 25 '11 at 17:27
    
Plus One to MikeyB! Haha! Good one! –  Mister IT Guru Jan 25 '11 at 17:27
2  
Its actually really good advice. Educate her about servers, it'll go a long way. Yesterday on an NCIS episode someone picked a laptop up by the screen and my wife just shrieked. I was so proud :) –  Sirex Jan 25 '11 at 18:35

4 Answers 4

up vote 11 down vote accepted

To change the actions that the server takes when it receives an ACPI event indicating the power button, edit the: /etc/acpi/powerbtn.sh script.

This will not prevent holding the button to force power off, however.

While we're at it, the line in /etc/inittab:

ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now

Controls the action taken upon pressing C-A-D.

share|improve this answer
    
For the Ctrl-Alt-Del, I won't care very much as my server has no keyboard. But thanks for the powerbtn.sh script location. –  Jonathan Rioux Jan 25 '11 at 18:30
    
Just to note: current testing/unstable does not use this script, but have it for users in /usr/share/doc/acpid/examples/powerbtn.sh. –  pevik Sep 12 '13 at 6:56

Although you can catch a power button press through ACPI, you can't prevent your girlfriend from pressing and holding the button (to force power down), or from pulling the plug on your server.

My best suggestion is to talk to your girlfriend. Communication is key ;)

share|improve this answer

I found these instructions for ArchLinux which also apply for most distributions. If none of it is applicable just search with a bias to your particular distribution. It's a common enough question. You will have to tailor it depending on your desktop environment as well.

Instead of the action being /usr/sbin/shutdown, write a simple script to pop up a notification on the screen that says something to the effect of "Hey Girlfriend, don't you do me like that. I dun told you!" The script might be in Python using the DBus interface to libnotify.

share|improve this answer

Pu in a nuclear battery.

Seriously, you can not. And if you manage, she will pull the plug.

The power plug on a computer is on the power supply and is a physical switch. Note that 2turn off on gfront" is not the power button, but puts the computer technically into standby. As you come to a system administrator website, opposed to superuser.com, I assume you know that.

Now, how would you suggest you can keep a power supply running when you PHYSICALLY DISCONNECT it from the power grid, which is what the power button on the power supply does.

Hint: not possible.

share|improve this answer
1  
Many systems these days do not have any power buttons or switches other than the one hooked up through ACPI. Your answer is basically a decade out of sync. Also, it's kind of rude, not to mention partly incoherent. –  mattdm Jan 25 '11 at 18:24
    
She cannot pull the plug because iv screwed it into the server case. –  Jonathan Rioux Jan 25 '11 at 18:40

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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