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. Your mode of telling alll in thi poszt is genuinely fastidious, every one be
    able to efforlessly understand it, Thanks a lot.

  2. tubemarco says:

    Why viewers still make usee oof to read news papers when in this technologtical world everything
    is avsilable on net?

  3. Its registered location offers lucrative tax incentives, that
    allow the corporation to deliver attractive odds and regular bonus
    offers. You won’t have to worry about out of control dealing when pitching Copag.
    It teases you having a large amount of jackpot if you possibly could receive the matching themes when playing the
    bingo on online casino.

  4. On every full house win, you here can grab the jackpot linked to it.

    Therefore, even the bonds of best casino online with wagering requirements.
    He secured the 643rd along with the 778th slot inside 2011 and 2012 Player
    from the Year Rank respectively.

  5. Forts: The great freedom fighters like Nana Saheb, Tatya Tope
    and Rani Laxmi Bai of Jhansi started their struggle for freedom in the year 1857 from Bithoor and during their stay numerous forts were built which are
    still a source of inspiration and attraction to the Historian and research oriented people.
    On the yes side, defining quality as desirability of ownership with a sense of
    beauty and artistic interpretation, the answer in most cases
    is yes. Ask a sales woman to help you find sizes that fit and try going
    too small and too big to understand what the right fit is.

  6. jav porno says:

    I amm sure this piece of writing haas touched all the internet viewers,
    its really really good piece of writing onn building up new weblog.

  7. 918kiss trik says:

    This text is worth everyone’s attention. How can I
    find out more?

  8. Hello, i think that i saw you visited my web site thus i came to “return the favor”.I’m trying to find things to improve my web site!I suppose its
    ok to use some of your ideas!!

  9. Euro – Millions lottery answers are also displayed just after the draw held,
    it’s also possible to view result videos. These types of plays have with these various models of
    different games which are both conventional and newest games.
    If you fail to be well prepared for your interview, it might lead to delay or denial of the visa.

  10. Hmm it seems like your website ate my first comment (it was extremely long) so I guess I’ll just sum it up what I had written and say, I’m
    thoroughly enjoying your blog. I too am an aspiring blog writer but I’m still new to the whole thing.
    Do you have any tips and hints for first-time blog writers?
    I’d certainly appreciate it.

  11. minecraft says:

    I’m impressed, I must say. Seldom do I come across a blog that’s both equally educative and amusing, and let me tell you,
    you have hit the nail on the head. The problem is something not enough men and women are
    speaking intelligently about. Now i’m very happy that I stumbled across this during my hunt for something relating to this.

  12. It’s amazing to go to see this web page and reading the
    views of all colleagues regarding this piece of writing,
    while I amm also zealous of getting familiarity.

  13. These are actually wonderful ideas in on the topic of blogging.

    You have touched some nice factors here. Any way keep up wrinting.

  14. I have read so many posts on the topic of the blogger
    lovers but this piece of writing is really a nice piece of writing,
    keep it up.

  15. each time i used to read smaller articles or reviews that as well clear their motive, and that is also happening with this paragraph which I am reading here.

  16. My brother suggested I might like this website. He was totally right.
    This post truly made my day. You can not imagine just how much time
    I had spent for this info! Thanks!

  17. I do not even know how I ended up here, but I thought this post was great.
    I do not know who you are but certainly you’re going to a famous blogger if you are not already 😉 Cheers!

  18. My brother recommended I might like this web site.
    He was entirely right. This post truly made my day.
    You can not imagine just how much time I had
    spent for this information! Thanks!

  19. What’s up to all, how is all, I think every one is getting more from this site,
    and your views are good for new viewers.

  20. Woah! I’m really digging the template/theme of this blog.
    It’s simple, yet effective. A lot of times it’s tough to get
    that “perfect balance” between user friendliness and appearance.
    I must say you’ve done a awesome job with this.
    Also, the blog loads extremely quick for me on Internet explorer.
    Outstanding Blog!

  21. Hello Dear, are you really visiting this site daily, if so then you will
    without doubt obtain nice experience.

  22. Hi there friends, its fantastic paragraph regarding cultureand completely defined, keep
    it up all the time.

  23. tsunami says:

    Wow, awesome blog layout! How long have you besen blogging for?
    you make blogging look easy. The overall look of your web site is
    fantastic, let alone tthe content!

  24. minecraft says:

    Thanks a lot for sharing this with all people you really understand what you’re talking about!
    Bookmarked. Kindly additionally consult with my site =).
    We may have a link trade agreement between us

  25. I was curious if you ever considered changing the structure of your website?
    Its very well written; I love what youve got to say.
    But maybe you could a little more in the way of content so people could connect
    with it better. Youve got an awful lot of text for only having one or two pictures.
    Maybe you could space it out better?

  26. minecraft says:

    I’d like to find out more? I’d love to find
    out some additional information.

  27. Does your site have a contact page? I’m having a tough time locating it but, I’d like
    to shoot you an email. I’ve got some recommendations for your blog you might be interested in hearing.
    Either way, great blog and I look forward to seeing it expand over time.

  28. minecraft says:

    I love what you guys are usually up too. Such clever work and exposure!

    Keep up the excellent works guys I’ve added you guys to my own blogroll.

  29. minecraft says:

    We are a group of volunteers and starting a new scheme
    in our community. Your site provided us with valuable
    info to work on. You have done a formidable job and our
    whole community will be grateful to you.

  30. minecraft says:

    Howdy are using WordPress for your blog platform? I’m new to
    the blog world but I’m trying to get started and set up my own. Do you require any
    coding knowledge to make your own blog? Any help would
    be greatly appreciated!

  31. minecraft says:

    I like the valuable info you provide in your articles.
    I will bookmark your weblog and check again here regularly.
    I’m quite certain I will learn many new stuff right here!
    Best of luck for the next!

  32. minecraft says:

    Hi there just wanted to give you a brief heads up and let you
    know a few of the images aren’t loading properly. I’m not sure why but I think its a linking issue.
    I’ve tried it in two different web browsers and both show the same results.

  33. Thanks for one’s marvelous posting! I truly enjoyed reading it, you might be a great author.I will ensure that I bookmark your blog and will often come back later on.
    I want to encourage one to continue your great job, have a nice evening!

  34. Outstanding post however , I was wondering if you could write a litte
    more on this subject? I’d be very thankful if you could elaborate a little bit further.
    Kudos!

  35. Hi, i read your blog from time to time and i own a similar one and i was just wondering if you get a lot of spam comments?
    If so how do you prevent it, any plugin or anything you can recommend?
    I get so much lately it’s driving me mad so any support is very much appreciated.

  36. Thank you a bunch for sharing this with all folks you really know what you are speaking approximately!
    Bookmarked. Kindly also seek advice from my web site =).
    We will have a link change contract among us

  37. I would like to thank you for the efforts you have put in writing this website.
    I am hoping to view the same high-grade blog posts from
    you in the future as well. In fact, your creative writing abilities has encouraged me to get my very own website now ;
    )

  38. This is a topic which is close to my heart… Cheers! Exactly where are your contact details though?

  39. Hmm is anyone else experiencing problems with the pictures on this blog loading?

    I’m trying to find out if its a problem on my end
    or if it’s the blog. Any feed-back would be greatly appreciated.

  40. minecraft says:

    WOW just what I was searching for. Came here by
    searching for minecraft

  41. Hello there! I know this is kind of off topic but I was wondering if you knew where I could get a captcha plugin for
    my comment form? I’m using the same blog platform as yours and
    I’m having difficulty finding one? Thanks a lot!

    maglia Liverpool poco prezzo

  42. minecraft says:

    Hey There. I found your blog using msn. This is a very well written article.
    I will make sure to bookmark it and return to read more of your useful
    info. Thanks for the post. I will certainly comeback.

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 )

Connecting to %s

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