Thread: reboot on reset
View Single Post

   
  #3 (permalink)  
Old 01-18-2008, 06:34 PM
Moe Trin
 
Posts: n/a
Default Re: reboot on reset

On 30 Aug 2006, in the Usenet newsgroup comp.os.linux.setup, in article
<1156979187.726537.260980@74g2000cwt.googlegroups. com>, dmedhora@gmail.com
wrote:

>I would like to reboot/halt my system when I press the reset
>button ( beside the power button) on my computer.


Assumption: x86 type system (there is no reset button on a Mac, or most
other hardware that I'm aware of).

>the other day my system went wild. I was trying to use a dvdram
>disc as a share in samba. While copying files to it, the keyboard
>suddenly stopped responding and the console displayed tons of
>messages real fast.


Sounds like a hardware problem - hope you've got known good backups.

>I pressed the reset button as thats all I could do, and it reset power
>but I would like it to reboot.


Not exactly sure what you mean by "it reset power". On Intel type of
hardware (includes AMD, Cyrix, and so on), the reset button shorts a
signal called "PWR_OK" to ground. This signal is normally _generated_
on startup by the power supply, and indicates that the voltage used
to power the CPU and/or logic is above a minimum. This signal connects
to the /RESET pin on the CPU, (and other chips on the motherboard that
have such a pin), and to the /RESET pin on each ISA, EISA, MCA, VESA,
and/or PCI card in the system. While the signal is low (shorted to
ground), nothing is running. If the signal is held low for some minimum
time (usually defined as some number of CPU clock cycles - 15 is a good
number, and that's about a quarter of a millionth of a second), while
the power supply is delivering something like rated voltage, when the
signal is released (goes high), the CPU starts executing the "Good
Morning, World" code in the BIOS. This involves testing RAM, seeing
what hardware it can talk to, and so on. There is no operating system
involved in this.

>Is there an option in inittab for this? Something like the entry for
>ca:ctrlaltdel ?


No - /etc/inittab is something that is run by the first application
to run _after_ the operating system is running. This is _LOOOOONG_
after the BIOS has done it's thing. See the fine HOWTO called

43309 Nov 5 2000 From-PowerUp-To-Bash-Prompt-HOWTO

which may be on your system, but is widely available on the web.

>So that in case I cannot salute I can alteast reset the computer and be
>assured that the shutdown is gracefull ?


Nope! The reset switch is worse than a "kill -9", as it completely halts
the CPU (and hopefully the disk drive controller) in it's tracks, RIGHT
NOW - Do Not Pass Go - don't even _think_ about $200. Unlike a kill -9,
there is no escape just because something is busy - everything is stopped
immediately. It the disk is in the middle of writing something, that's
tough bananas.

Now what you might have seen is the display apparently power cycle. This
may occur with the modern "power management" monitors, that will go to
sleep (the "green" LED changes to "amber") when the video drive ceases.
Seeing as how the CPU is stopped, there is no reason to expect any
video, and this would occur. Likewise, the keyboard would (when you
release the reset button) go into the same "Good Morning World" self-test.

There really isn't a clean way to _reliably_ grab a CPU by the shorts to
get it's attention when it goes berserk. The only thing that will work
is to reset it to a power-on state. There are several things that you
can _try_ such as SSH/Telnet/rsh/rlogin (somehow open a terminal session
over the net), try switching to an alternate console (you're probably
running X, so try pressing the left Ctrl and Alt keys, and perhaps the
F7 key - one more than the number of mgettys you are running out of
/etc/inittab - press the left Alt and F1 key to return to X), or even
try killing X with the left Ctrl, Alt, and Backspace key (which kills
X - though it will restart if you are using a GUI login). These actions
_may_ give you access to a command line, where you can start killing
things. I wouldn't count on it.

If this is a real server, you should have a UPS protecting it against
power outages. This _usually_ has the capability of causing a clean
shutdown when power fails. You _MAY_ be able to cause the UPS to tell
the system to shut down cleanly, but that assumes the CPU is even looking
at the UPS. In an "off the rails" condition, I wouldn't count on this
either.

Old guy
Reply With Quote