Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Server
User Name
Linux - Server This forum is for the discussion of Linux Software used in a server related context.


  Search this Thread
Old 12-03-2007, 11:19 AM   #1
LQ Newbie
Registered: Dec 2007
Posts: 1

Rep: Reputation: 0
power outage

How can one tell if your linux server has experienced a power outage. For example, i have 2 servers in a datacenter. If the power goes out, is there a log that will tell me that the power went out unexpectedly?? I am using redhat enterprise 4 advanced server.
Old 12-03-2007, 11:51 AM   #2
LQ Newbie
Registered: Oct 2004
Distribution: Debian, Ubuntu, DSL, TRK, etc.
Posts: 18
Blog Entries: 3

Rep: Reputation: 3
Well, who -b will tell you when the system was last booted; you could have a script check this periodically and email you if it changes.

So something like a combination of the following would email you only on unexpected reboots.

touch /deliberateshutdown

crontab entry:
*/5 * * * * /usr/local/bin/check-reboot


if [ -f /deliberateshutdown ]; then
rm /deliberateshutdown
who -b > /var/run/lastboot
elif ! cmp /var/run/lastboot <(who -b) >/dev/null; then
mail root -s power <<<"There may have been a power outage"
who -b > /var/run/lastboot


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
10.1 some errors after power outage future assassin Slackware 3 11-04-2005 05:33 PM
power outage jbzy3000 Linux - General 2 02-24-2005 09:11 PM
Power Outage horror Hampster Mandriva 5 01-13-2005 08:38 PM
Reboot after power outage oigeli Linux - General 1 12-02-2004 07:10 AM
Power Outage notslim General 30 08-28-2003 03:47 AM > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 07:46 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