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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
03-12-2003, 12:39 PM
|
#1
|
Member
Registered: Jan 2003
Location: United States of America and damn proud of it!
Distribution: Windows 10 prior Red Hat User
Posts: 473
Rep:
|
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
|
|
|
03-12-2003, 12:50 PM
|
#2
|
Member
Registered: Dec 2001
Location: Oklahoma City, OK, USA
Distribution: Xubuntu 16.04 LTS
Posts: 214
Rep:
|
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)...
|
|
|
03-12-2003, 01:35 PM
|
#3
|
Moderator
Registered: Aug 2002
Posts: 26,203
|
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/
|
|
|
03-12-2003, 01:41 PM
|
#4
|
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:
|
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?
|
|
|
03-12-2003, 03:14 PM
|
#5
|
Moderator
Registered: Aug 2002
Posts: 26,203
|
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.
|
|
|
03-12-2003, 03:40 PM
|
#6
|
Member
Registered: Dec 2001
Location: Oklahoma City, OK, USA
Distribution: Xubuntu 16.04 LTS
Posts: 214
Rep:
|
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...
|
|
|
All times are GMT -5. The time now is 08:43 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|