1

What can I do to configure a Linux (Debian Lenny) machine so I can simply switch it off and on at the wall, and never bother cleanly shutting it down ever..

This filesystems are all ext3 and the hard disk write buffers are enabled (IDE disk). I also have "barrier=1" as an additional mount option which I believe is enough to keep the filesystems from corrupting. Are there other services / lock files / etc that need tweaked to make this possible?


This is a headless home server mainly acting as NAS and running a few other trivial services. It'd be great to instantly power it off at night by flipping the power at the wall.

2
  • 6
    What the hell is wrong with you? :P Hibernate take too long?
    – Phoshi
    Nov 16, 2009 at 21:04
  • 1
    As TylerF pointed out, do you want a quick shutdown or do you want a convenient shutdown? Or are you looking for both?
    – Nathaniel
    Nov 16, 2009 at 23:45

2 Answers 2

25

I don't believe you can really accomplish this in a way that's always going to be "safe". Turning power off on a system can cause problems and unless you don't DO anything on the system, there's always the possibility of something going wrong.

Why not install a simple backup battery and have the system monitor for a critical state or simply for a switch to battery power? So when you hit the wall switch, the system goes to battery power which is then almost immediately caught by upsmon and you can shut down the system gracefully. It will shut down within seconds but you don't run the risk of having things break.

You don't need much battery capacity -- just enough power to shut down.

On an embedded system with a well-defined state machine, a total loss of power can be handled more easily but even there, the software providing services needs to be able to know how to recover if power is lost at any state.

I'd play it safe and go with a UPS between you and the system.

3
  • Exactly what I was thinking. Nov 16, 2009 at 22:11
  • Let's see if we can throw a spatula, ping pong ball, hamster wheel, some dominoes, and a toaster into the mix, too. ;) Although this technically answers the question as specified, it reminds me of Rube Goldberg's machines. Rigging up a UPS for the express purpose of shutting down seems silly, especially since the battery will degrade over time and eventually will not hold enough charge for a proper shutdown. You'd probably want to set the critical state to pretty high (95%?) since repeated full discharges will damage the lead acid battery that's probably in your UPS.
    – rob
    Nov 17, 2009 at 0:30
  • well -- you can see when it transitions to battery (rather than waiting for a critical level) and just shut down then. Agreed -- it's contrived to do it this way. But I still think it's better than simply killing the thing. Nov 17, 2009 at 2:09
5

I haven't looked into this myself, but is it not possible to set it so when the On button is pressed, it shuts down. This way you can just press the power button, and it will shut down.

I assume you wanted to be able to shut it down at wall because you wanted a quick and easy way to shut it down.

3
  • Some computers/operating systems seem finicky about this; I have a computer that immediately powers off when I touch the power button, even though the BIOS is configured for a 4-second delay. Still, very good tip if your computer isn't defective like that one of mine.
    – rob
    Nov 17, 2009 at 0:32
  • 1
    @rob, That's rare... Nov 17, 2009 at 2:15
  • I guess I've just been very lucky, then. :D
    – rob
    Nov 17, 2009 at 18:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .