LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
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?

Notices

Reply
 
Search this Thread
Old 03-12-2003, 12:39 PM   #1
scottpioso
Member
 
Registered: Jan 2003
Location: United States of America and damn proud of it!
Distribution: Ubuntu
Posts: 466

Rep: Reputation: 30
Batch Script to shutdown the system in the event of power loss


Does anyone have any knowledge of whether it's possible to write a shell or batch script to shutdown the system in the event of a power loss? I'm considering a UPS but have not bought one yet. However, I do have important data on this server that I would not want to lose if I lose AC power.

Any ideas would be appreciated. Thank you

Scott
 
Old 03-12-2003, 12:50 PM   #2
JimKyle
Member
 
Registered: Dec 2001
Location: Oklahoma City, OK, USA
Distribution: Xubuntu 12.04 LTS
Posts: 156

Rep: Reputation: 18
I'm using a UPS that includes a serial port, together with a driver that receives the signal from the UPS whenever it switches to battery power. It's configured to do a shutdown 5 minutes after the switch, unless power comes back up during that time. The delay allows for momentary power glitches without forcing shutdown, and the UPS is sturdy enough to keep the box going for at least 15 minutes so there's time for the shutdown.

I've tested it by pulling the plug on the UPS, and it works perfectly. Be sure, though, when you get your UPS to make certain it has the port to notify the computer! My first two did not have this capability. Since then I've learned to look for it (I only have six UPSes scattered around my LAN; only the one on the file server is set up to guarantee proper shutdown)...
 
Old 03-12-2003, 01:35 PM   #3
michaelk
Moderator
 
Registered: Aug 2002
Posts: 11,909

Rep: Reputation: 747Reputation: 747Reputation: 747Reputation: 747Reputation: 747Reputation: 747Reputation: 747
You would need a service that works in the background.

I suggest APC. From what I have see the new ones have a USB port but you can write to them for a serial port adaptor cable.

The linux version of powerchute (shutdown application) only works with the serial port.

Here is another source for a shutdown application. Don't know if it works with the new APC's or not.
http://www.sibbald.com/apcupsd/
 
Old 03-12-2003, 01:41 PM   #4
scottpioso
Member
 
Registered: Jan 2003
Location: United States of America and damn proud of it!
Distribution: Ubuntu
Posts: 466

Original Poster
Rep: Reputation: 30
Thanks!! I presume when you buy it, the device has instructions on how to set it up to work with your server to shut it down in the event of power loss, correct?
 
Old 03-12-2003, 03:14 PM   #5
michaelk
Moderator
 
Registered: Aug 2002
Posts: 11,909

Rep: Reputation: 747Reputation: 747Reputation: 747Reputation: 747Reputation: 747Reputation: 747Reputation: 747
Its been awhile i.e. 5-6 years since I bought mine so I can't say if they include any instructions for linux. If the linux version isn't included on the CD you can download it from APC's website.
 
Old 03-12-2003, 03:40 PM   #6
JimKyle
Member
 
Registered: Dec 2001
Location: Oklahoma City, OK, USA
Distribution: Xubuntu 12.04 LTS
Posts: 156

Rep: Reputation: 18
I didn't get any Linux instructions on the CDs with mine, just Win32. However the APC site has the Linux drivers and they work with non-APC systems also. Most all the trigger circuits seem to be standardized!

A Google search also took me to a site that had instructions for adding a trigger output to a UPS that didn't have one already, but it was easier to just use one that came from the factory complete...
 
  


Reply


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
Lockup on power event... grcore Mandriva 4 10-10-2005 07:19 AM
system shutdown power outage rhandwor Fedora 3 10-10-2005 02:02 AM
Shutdown the System remotely via PHP-Script? linuxuser2005 Linux - General 2 08-30-2004 11:53 AM
script to shutdown system - howto matthewchin Linux - General 5 07-11-2004 11:11 PM
Shutdown script wont physically turn off my system... cav Slackware 2 09-13-2003 02:06 AM


All times are GMT -5. The time now is 11:57 PM.

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