[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

shutting down computer using /dev/ttySx




On Tue, Dec 11, 2001 at 01:46:11PM +0900, Olaf Meeuwissen wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Olaf Meeuwissen <olaf@epkowa.co.jp> wrote:
> 
> > I'm maintaining a (small-time) group server for our department.  In
> > order to satisfy company policy requirements I need to provide a way
> > to shutdown the server in case of emergencies.  Our network admin was
> > kind enough to give me two alternatives:
> > 
> >   1) provide an on-screen shutdown button
> >   2) provide a shutdown user account (and document its usage)
> > 
> > Suggestions, discussions of pros and cons welcome,
> 
> Thanks to everyone who responded.  I should have been a little clearer
> on the system setup.  The machine in question consists of a main unit
> and a bunch of externally attached hard disks connected to a network.
> It has no monitor, keyboard (what Ctrl-Alt-Del?) and mouse.

That is pretty simple :-)

run this script during the boot with  "nohup /dir/send.sh &"

--- begin of send.sh ---
#!/bin/sh
while true; do
  echo -n "pzn" > /dev/ttyS0  #send 3 bytes to serial port
  sleep 1
done
--- end of send.sh ---

and also run this during boot "nohup /dir/receive.sh &"

--- begin of receive.sh ---
#!/bin/sh
head -c 9 /dev/ttyS0   #waits to receive 9 bits from serial port
echo -n "\007" > /dev/console   #beep the pcspeaker
sleep 1
echo -n "\007" > /dev/console   #beep the pcspeaker
sleep 1
halt   #shutdown the system
--- end of receive.sh ---

then put a switch that when pressed shorts pins 2 and 3 of your serial
port /dev/ttyS0.

that is it. just press the switch for 3 seconds to shutdown the machine.

if it does not work, then configure setserial to use "no flow control"
on /dev/ttyS0

   Good luck,
   Pedro



Reply to: