Automatic shutdown when power button pressed..
I am currently running a linux fileserver, and I would like to make it possible so that once the machine is running, then by pressing the power button it will automatically shutdown and switch off. Currently, pressing the power button doesn't do anything.
How would I set it up (using APM or whatever) so that the machine will automatically shutdown? Thanks in advance. :newbie: |
It's never a good idea to shutdown just using the power button. Linux has a sequence it has to go through to unmount devices and filesystems safely. If you just turn the button off, it could corrupt your filesystem.
|
Quote:
|
Comments:
1.As darthtux already said, it would be a poor idea to just power off the machine. It would be equivalent to yanking the plug out of the socket, and the risks of damaging your system would be high. 2. AFAIK, No, there is no way to "attach" a shutdown procedure to the power button. 3. Regarding your comment that "pressing the power button doesn't do anything" -- some machines, like my Dell at work, require that you hold the power button down for several seconds before the power cuts off. The idea presumably is to minimize the chances of an accidental shutdown. -- J.W. |
Here are a few things to try.
http://www.cs.helsinki.fi/linux/linu...1-31/0968.html http://www.netfort.gr.jp/~matsu/i82371/README http://lists.debian.org/debian-user/.../msg04077.html And some advice for the others, if you dont know how to fix or do what someone asks, don't answer! |
Quote:
BTW, click on the search button under my name. A lot of people have thanked me for helping them. |
First, try shutting down the computer with the command "poweroff".
Does your computer shutdown and poweroff? If it does, you may be able to do this. To find out if your power button can do this, you need to know if you have a "software power button". If you do, its just a matter of mapping that "key" to the "poweroff" command. Check out this thread for all the info, it helped me: http://bbs.archlinux.org/viewtopic.php?t=937 |
I used to have a keyboard with a "Power Off" button, that when pressed, under Windows, would go through proper shutdown and switch off the machine. This is effectively what I'm trying to get at, but using the power switch on the case rather than a key on the keyboard.
J.W.: In regard to your 3rd point, I know that holding the power button down does a hard power-off, but it is the one-touch press that does something else, that currently isn't set to do anything - hence my comment about it not doing anything.. Sorry if I was unclear. Here's a short explanation of how the server currently acts: It is used by my entire family as a file/print server, and I'm not always here, so I'm trying to make it as easy as possible for the non-techie members of the family to use. To switch on, just press power.. easy. To switch off, I've made a user called "shutdown", and if you log on as that user then the machine automatically shuts down and switches off. That's a step in the right direction, but if possible I'd like to make it even easier. This is why I'm trying to map a software command to the power button being pressed, as I've described. Caeda & contrasutra: I will read those links and try what I can, and I'll report my progress here for future reference. Thanks people. |
In the mean time you can set the ctrl-alt-del sequence to shutdown the system. Not familar with gentoo but usually its configured to reboot.
The configuration setting is located in /etc/inittab file |
Mr Smidge - I understand your point. The original intent of my post was really only to emphaize the dangers of doing a hard power down without allowing the system to do an orderly shutdown first. About a year ago we had a blackout in my neighborhood during a storm, and long story short, it killed my system, and I needed to do a reinstall as a result. If anything I can say can help someone else avoid the same predicament, I'll put in my 2 cents.
Caeda - I suppose that your, um, "scolding" might also be directed at my post. Not to be defensive, but considering that points #1 and #3 in my post are factually correct, and that I prefaced point #2 with "AFAIK", I fail to see how my post could possibly be considered misleading or incorrect. Since you seem to be so keen on doling out advice to others, I'll assume that you're equally receptive to being given advice yourself, and with that in mind, you might consider this (and again I'll second darthtux): Unless you're a moderator, please refrain from broadcasting your opinion on who should or should not submit a well-intentioned reply to a question. In my experience with this board, we're all just trying to lend a helping hand in whatever way we can. Regards. -- J.W. |
All times are GMT -5. The time now is 04:13 PM. |