LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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: Windows 10 prior Red Hat User
Posts: 473

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 16.04 LTS
Posts: 214
Blog Entries: 1

Rep: Reputation: 39
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: 26,203

Rep: Reputation: 6089Reputation: 6089Reputation: 6089Reputation: 6089Reputation: 6089Reputation: 6089Reputation: 6089Reputation: 6089Reputation: 6089Reputation: 6089Reputation: 6089
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: Windows 10 prior Red Hat User
Posts: 473

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: 26,203

Rep: Reputation: 6089Reputation: 6089Reputation: 6089Reputation: 6089Reputation: 6089Reputation: 6089Reputation: 6089Reputation: 6089Reputation: 6089Reputation: 6089Reputation: 6089
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 16.04 LTS
Posts: 214
Blog Entries: 1

Rep: Reputation: 39
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

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 08:43 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration