Did you know LQ has a Linux Hardware Compatibility List?
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 10-05-2007, 03:13 PM   #1
LQ Newbie
Registered: Sep 2007
Posts: 7

Rep: Reputation: 0
Command or grep to know system reboot time

My server restarted twice, i need to know in what time my server restarted ,
i know these command help to know the uptime , i need only when its start restarted


[root@basema log]# grep restart messages
Sep 30 04:04:09 basema syslogd 1.4.1: restart.
Oct 5 01:51:21 basema syslogd 1.4.1: restart.

[root@basema log]# last | grep boot
reboot system boot 2.6.9-42.ELlarge Fri Oct 5 01:51 (12:26)
reboot system boot 2.6.9-42.ELlarge Thu Oct 4 07:05 (1+07:11)
reboot system boot 2.6.9-42.ELlarge Thu Oct 4 06:44 (00:17)
reboot system boot 2.6.9-42.ELlarge Thu Oct 4 01:01 (06:00)

[root@basema log]# last -x|grep shutdown | head -1
shutdown system down 2.6.9-42.ELlarge Thu Oct 4 07:02 - 14:27 (1+07:25)

[root@basema log]# last reboot | head -1
reboot system boot 2.6.9-42.ELlarge Fri Oct 5 01:51 (12:37)

[root@basema log]#

[root@basema log]# who -b

system boot Oct 5 01:51
Old 10-05-2007, 03:30 PM   #2
LQ Guru
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
cat /var/log/messages.log | grep "Kernel command line"

..would likely do the job for you. The only time that phrase is issued is during boot. NOTE - you can likely grep the syslog file too, it should contain the similar information. Though at a glance, it looks like you already have identified enough info yourself there, to determine when it rebooted.. No?

Last edited by GrapefruiTgirl; 10-05-2007 at 03:32 PM.
Old 10-05-2007, 04:49 PM   #3
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,047
Blog Entries: 11

Rep: Reputation: 907Reputation: 907Reputation: 907Reputation: 907Reputation: 907Reputation: 907Reputation: 907Reputation: 907
I think that if it restarts "spontaneously" (be it via power-glitch,
software bug or hardware failure) you won't see an indication of it
going away, only of the start-up phase.



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 On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: grep 'Reboot The User' FOSSBiz LXer Syndicated Linux News 0 08-17-2006 10:21 AM
Why does my system reboot every time i try.... Hdstdlxe Linux - Newbie 9 10-22-2005 05:31 AM
"grep" Command (SystemV/68 system) xtremexp Other *NIX 3 05-28-2005 08:25 PM
setting system time via the command line ibm5_25 Linux - Software 3 01-18-2004 11:41 PM
how set system time by command prompt? yenonn Linux - Newbie 9 08-25-2003 07:40 PM

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