Script to find “How much time taken for Server Reboot?” in Linux

Posted: September 8, 2015 in Amount of Reboot Time, Shell Script

Script : serverreboottime.sh

#!/bin/bash

#script to find out how much time tokk for previous reboot

clear

echo -e “\n\tScript to find How much time taken Linux Server for last Reboot\n”

#BT = Server Boot Time After Reboot
BT=`last -F reboot | head -n 1 | awk ‘{print $5,$6,$7,$8,$9}’`

#RT = Server Rebooted time
RT=`last -F reboot | head -n 2 | awk ‘{print $11,$12,$13,$14,$15}’| tail -1`

echo -e  “Server Boot Time after Reboot = $BT”;
echo -e  “Server Rebooted Time          = $RT”;

#Note below output is should print the value between different date also Example JAN 10 23:59:21 server rebooted again server is came up at JAN 11 00:04:54 it should calculate the difference

echo -e “\nAmount of Time Reboot (seconds)  = $(( $(date -ud “$BT” +’%s’) – $(date -ud “$RT” +’%s’) ))Sec” ;

echo $(( $(date -ud “$BT” +’%s’) – $(date -ud “$RT” +’%s’) )) > out.txt

seconds=`cat /root/out.txt`

echo “Amount of Time Reboot (MM:SS)    = $((seconds/60))Min $((seconds%60))Sec”

echo “Amount of Time Reboot (HH:MM:SS) = $(date -d @$(( $(date -d “$BT” +%s) – $(date -d “$RT” +%s) )) -u +’%H:%M:%S’)”

 

Run :[root@test ~]# ./serverreboottime.sh

 

Output :

Screenshot_1

Comments
  1. judi says:

    Fastidious replies in return of this query with firm arguments and describing the whole
    thing concerning that.

  2. Kurt Makel says:

    you can buy some promise rings from ebay but those are the cheap ones, the quality ones are sold elswhere,,

  3. Wow! At last I got a blog from where I be able to
    genuinely take useful data concerning my study and knowledge.

  4. Bruce Gajda says:

    currency trading is a bit tricky compared to internet marketing but you could earn a lot from it,

  5. Nice blog here! Additionally your website so much up fast! What web host are you using? Can I get your affiliate link in your host? I desire my website loaded up as fast as yours lol.

  6. Dorcas Meury says:

    The color of your blog is quite great. i would love to have those colors too on my blog.”;:-`

  7. Hello, Neat post. There’s an issue together with your web site in internet explorer, may test this?
    IE still is the marketplace chief and a good
    section of other folks will omit your magnificent writing because of this problem.

  8. I actually wanted to compose a small note to be able to appreciate you for these nice advice you are giving out on this site. My considerable internet lookup has now been rewarded with useful knowledge to share with my neighbours. I ‘d believe that many of us site visitors are definitely endowed to dwell in a good site with many special people with good tricks. I feel very much fortunate to have discovered the weblog and look forward to many more pleasurable minutes reading here. Thanks a lot once more for everything.

  9. Thanks a ton for your efforts to have decided to put these things together on this site. Janet and i also very much liked your suggestions through the articles with certain things. I understand that you have a number of demands on your program therefore the fact that an individual like you took just as much time just like you did to steer people like us through this article is even highly prized.

  10. Heya i’m for the first time here. I came across this board and I
    find It really useful & it helped me out a lot. I hope
    to give something back and aid others like you helped me.

  11. Cari Adamek says:

    You make so many great points here that I read your article a couple of times. Your views are in accordance with my own for the most part. This is great content for your readers.

  12. Fantastic goods from you, man. I’ve understand your stuff previous to and you are just too fantastic. I actually like what you have acquired here, certainly like what you are saying and the way in which you say it. You make it entertaining and you still care for to keep it wise. I can’t wait to read far more from you. This is really a terrific site.

  13. Hi there! I could have sworn I’ve been to this blog before but after checking through some of the post I realized it’s new to me. Nonetheless, I’m definitely delighted I found it and I’ll be book-marking and checking back frequently!

  14. I just could not go away your site before suggesting that I really
    enjoyed the usual information an individual provide on your guests?
    Is going to be again frequently in order to check out new posts

  15. You are so interesting! I don’t suppose I have read through a single thing like this before.

    So wonderful to find someone with unique thoughts on this subject matter.
    Seriously.. thank you for starting this up.
    This site is one thing that’s needed on the web, someone with some originality!

  16. This is very interesting, You’re a very skilled blogger.

    I’ve joined your feed and look forward to seeking more of your wonderful post.

    Also, I have shared your site in my social networks!

  17. Lashonda says:

    I am extremely impressed with your writing skills and also with the layout on your
    weblog. Is this a paid theme or did you modify it yourself?

    Anyway keep up the excellent quality writing, it is rare
    to see a great blog like this one nowadays.

  18. mercedes says:

    Informative article, totally what I needed.

  19. Hello there, just became alert to your blog
    through Google, and found that it’s really informative. I am gonna watch out for
    brussels. I’ll be grateful if you continue this
    in future. Numerous people will be benefited from your writing.
    Cheers!

  20. I am not sure where you’re getting your info, but great topic.
    I needs to spend some time learning more or understanding more.

    Thanks for fantastic info I was looking for this info for
    my mission.

  21. I am truly delighted to read this blog posts which carries plenty of valuable information, thanks for providing these kinds of
    statistics.

  22. What’s up, constantly i used to check blog posts here in the early hours in the dawn, for the reason that i love to find
    out more and more.

  23. These are genuinely fantastic ideas in about blogging.
    You have touched some good factors here. Any way keep up wrinting.

  24. Excellent post. I will be facing many of these issues
    as well..

  25. Superb blog you have here but I was curious about if you knew of any message boards that cover the same topics talked about here?
    I’d really like to be a part of community where I can get comments from
    other knowledgeable individuals that share the same interest.
    If you have any suggestions, please let me know. Appreciate it!

  26. I every time spent my half an hour to read this blog’s articles or reviews everyday along with a cup of coffee.

  27. We stumbled over here from a different web page and
    thought I might check things out. I like what I
    see so i am just following you. Look forward to going over your
    web page for a second time.

  28. Hi, Neat post. There’s an issue together with your site in web explorer, could check
    this? IE still is the marketplace chief and a large element of people will leave out
    your magnificent writing because of this problem.

  29. Great post. I will be dealing with a few ᧐f theѕe issues as welⅼ..

  30. Nice post. Ӏ learn somеthing totally neᴡ ɑnd challenging оn websites І
    stumbleupon օn a daily basis. Ιt will alwaуs
    ƅe helpful to read through articles fгom othеr authors ɑnd սse
    ɑ little sometһing frоm ᧐ther sites.

  31. guong navado says:

    G᧐od post օnce again! Thank ʏou.

  32. I was suggested this blog by my cousin. I’m not sure whether this post is written by him as nobody else know such detailed about my
    difficulty. You’re amazing! Thanks!

  33. It’s very effortless to find out any topic on net as compared
    to books, as I found this article at this web site.

  34. Thank you for the good writeup. It in fact was a amusement account
    it. Look advanced to far added agreeable from you! However, how can we communicate?

    maglia napoli 2018 prezzo

  35. What’s up colleagues, nice article and pleasant urging commented here, I am genuinely
    enjoying by these.

  36. Wе would lіke to thank yօu ⲟnce agаin for
    tһe beautiful ideas yoս gave Jeremy wһen preparing һer post-graduate гesearch in addition to, mοst importantly, regaгding providing each of
    the ideas іn a blog post. Pгovided ԝe һad қnown of your web-site a year ago, we wоuld haνe beеn rescued from thе unwanted measures we were participating in. Thank уοu ѵery mᥙch.

  37. you are in reality a excellent webmaster. The site loading pace
    is incredible. It sort of feels that you’re doing any distinctive trick.
    In addition, The contents are masterwork. you have done a great
    activity on this subject!

  38. Hi, I log on to your blog оn a regular basis. Your writing style іs witty,
    кeep ᥙp the ցood work!

  39. Ι’m not surе where уou’re getting yoսr informatіon, but ɡood
    topic. I neеds tо spend ѕome timе learning mսch m᧐гe or understanding more.
    Ꭲhanks for excellent info Ι was looҝing for this information fߋr mү mission.

  40. Promotions says:

    You ought to be a part of a contest for one of the greatest sites online.
    I most certainly will highly recommend this website!

  41. 룰렛 says:

    Hello, i believe that i noticed you visited my weblog so
    i came to ?return the desire?.I am attempting to in finding issues to enhance
    my site!I assume its adequate to use a few of your concepts!!

  42. casino games says:

    casino online
    casino
    casino online
    casino
    casino

  43. Hі, I check yоur blog likе еvery ԝeek.
    Yߋur story-telling style іs witty, keep it up!

  44. 918kiss Link says:

    Everything published was very reasonable. However, consider this,
    suppose you were to create a killer post title? I am not suggesting your information is not good,
    but suppose you added a post title that makes people desire more?
    I mean Script to find “How much time taken for Server Reboot?” in Linux | Au-Tel
    Linux Admin is kinda boring. You ought to glance at Yahoo’s home page and see how they create post headlines to get
    viewers to click. You might add a video or a picture or two
    to get readers interested about everything’ve written.
    In my opinion, it might make your posts a little
    bit more interesting.

  45. I loved as much as you’ll receive carried out
    right here. The sketch is attractive, your authored subject matter stylish.
    nonetheless, you command get got an nervousness over that you wish be delivering the following.
    unwell unquestionably come more formerly again as exactly the same nearly very
    often inside case you shield this increase.

  46. I’m still learning from you, but I’m trying to achieve my
    goals. I certainly love reading all that is
    posted on your blog.Keep the posts coming. I liked it!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.