Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Hardware
User Name
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?


  Search this Thread
Old 05-03-2004, 09:03 PM   #1
Registered: Sep 2003
Location: Plano, TX
Distribution: Slack
Posts: 84

Rep: Reputation: 15
automatic shutdown via 12V relay

Hello All,
I am running a slackware based PC in my truck as an auxiliary audio/video/whoa ain't that cool device in my vehicle. The problem I have yet to solve is the shutdown issue. What I'd like to accomplish is an automatic shutdown via the powerswitch. I've got a power inverter hard-wired to the battery, so theoretically the PC constantly recieves 120V power, and I have to manually shut it down using the shutdown command, and start it using the power switch. Is there support in the kernel (or can it be compiled in) to accept normal shutdown from the powerswitch?? The eventual goal is to use a relay wired to a switched ignition source to give the PC off|on commands when I turn the ignition off and on. I know I could do a "fast off" simply by turning the inverter off with the ignition, and although warned about such "quick removal of power source" I have yet to cause a crash this way..... although I know eventually it would happen.

Any help would be appreciated greatly
Old 05-03-2004, 11:52 PM   #2
Senior Member
Registered: Mar 2003
Location: Burke, VA
Distribution: RHEL, Slackware, Ubuntu, Fedora
Posts: 1,418
Blog Entries: 1

Rep: Reputation: 46

I think this could be done with your serial port, rather than using a relay on the actual power switch.

Check out the "Coffee Maker HOWTO" at
They outline how to turn a switch on and off with linux and your serial port, for a coffee maker.
You could glean some information to use the serial port to pickup the presense of voltage, and run a script when the status changes, including a shutdown command. Turning it on would be aproblem, though.

Old 05-04-2004, 12:35 AM   #3
LQ Guru
Registered: Jan 2004
Location: NJ, USA
Distribution: Slackware, Debian
Posts: 5,852

Rep: Reputation: 357Reputation: 357Reputation: 357Reputation: 357
You could setup the system to mount everything as read-only (after it is all configured of course) and then you can kill the power to it without fear.
Old 05-04-2004, 09:23 AM   #4
Registered: Sep 2003
Location: Plano, TX
Distribution: Slack
Posts: 84

Original Poster
Rep: Reputation: 15
Both excellent suggestions!! I think I'll attempt the serial port control however, as I also have a wireless LAN connection in the box to allow the uploading of new material from my main PC in the house, and it's awful hard to upload to a read-only filesystem.
Old 05-04-2004, 10:52 AM   #5
Registered: Aug 2002
Posts: 16,341

Rep: Reputation: 1907Reputation: 1907Reputation: 1907Reputation: 1907Reputation: 1907Reputation: 1907Reputation: 1907Reputation: 1907Reputation: 1907Reputation: 1907Reputation: 1907
Actually, I have a piece of test equipment that uses a PC as the frontend. It has a switch (I haven't disassembled the unit yet to check it out) for power. When you physically place the switch to off it performs a shutdown so it is possible.

Check this out:


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Automatic shutdown using ping amelieo Linux - Networking 4 04-24-2004 05:59 AM
automatic shutdown in Mandrake 9.2 lu543285 Mandriva 1 02-13-2004 09:10 AM
automatic shutdown in Mandrake 9.2 lu543285 Linux - Hardware 1 02-13-2004 08:35 AM
automatic shutdown of Mandrake 9.2 (sometimes works sometimes not) lu543285 Linux - Hardware 1 02-06-2004 01:18 PM
Automatic shutdown NetScripter Linux - General 1 10-17-2002 03:45 PM > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 05:25 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration