Choose style:

Author Topic: Check to if a reboot is required.  (Read 2334 times)

0 Members and 1 Guest are viewing this topic.

Offline AndyInMokum

  • Global Moderator
  • Hero
  • *****
  • Posts: 4889
  • Karma: 1058
  • "Keep on Rockin' in the Free World"
    • View Profile
  • Peppermint version(s): PM 9 & PM 10 (64-bit)
Check to if a reboot is required.
« on: May 19, 2015, 10:28:14 pm »
I think most people at some time or another, ask this question after an update.  "Do I need to reboot my machine?"  The answer to this most of the time is, no.  However, if the update is installing a new kernel the answer is, yes you do need to reboot your machine.  Things can be a little vague at times.  Here's a little utility script that you can run from the terminal, to check if you need to reboot your machine.

In a terminal window run this command to create the empty file, Reboot-Check in your home folder.
Code: [Select]
cd ~ && gedit Reboot-Check
If you're running Peppermint 7, please use the following command:
Code: [Select]
cd ~ && pluma Reboot-Check
Hit enter.  When the empty file opens, copy and paste the following into it.
Code: [Select]
#!/bin/bash
if [ -f /var/run/reboot-required ]; then
  echo 'Please reboot your computer to complete your system update.'
fi
Save the file and quit gedit or pluma.  Enter the following command to make the file executable:
Code: [Select]
chmod +x ~/Reboot-Check
Hit enter.

You can now check if you need to reboot your machine by opening a terminal window and entering the following command.
Code: [Select]
cd ~ && ./Reboot-Check
If your machine needs to be rebooted.  The output of this command will look like this:
Code: [Select]
andy@andy-AMILO-Li3710 ~ $ cd ~ && ./Reboot-Check
reboot required
andy@andy-AMILO-Li3710 ~ $
If your machine does not require a reboot, there will be no output:
Code: [Select]
andy@andy-AMILO-Li3710 ~ $ cd ~ && ./Reboot-Check
andy@andy-AMILO-Li3710 ~ $
To further simplify this, lets copy the file ~/Reboot-Check to the folder, /usr/bin.
Code: [Select]
sudo cp -v ~/Reboot-Check /usr/bin
Hit enter and enter your password if asked.  Hit enter again.  Reboot your computer.  To run this check script, all you have to do now is enter:
Code: [Select]
Reboot-Check
in any terminal window and hit enter to return a confirmation of a reboot.  This is a nice and simple little utility script.  I hope you find it useful  ;).
« Last Edit: November 08, 2016, 01:22:50 am by AndyInMokum »
Backup! Backup! Backup! If you're missing any of these -  you ain't Backed Up!
For my system info please L/click HERE.

Offline PCNetSpec

  • Administrator
  • Hero
  • *****
  • Posts: 26452
  • Karma: 65531
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
  • Peppermint version(s): Peppermint 10
Re: Check to if a reboot is required.
« Reply #1 on: May 20, 2015, 07:54:22 am »
Another method would just be to run:
Code: [Select]
ls /var/run | grep reboot-required
if you get any output, you might want to reboot to finish applying the update changes.

Also be aware there's absolutely no *NEED* to reboot immediately .. it's only so the new kernel (or whatever other updated software) gets loaded in place of the older version, there's nothing wrong with continuing to use the current kernel until you next reboot, so no need to panic about this ;)
WARNING: You are logged into reality as 'root' .. logging in as 'insane' is the only safe option.

Team Peppermint
PCNetSpec

Offline Brotherred

  • Member
  • ***
  • Posts: 345
  • Karma: 11
  • No0b
    • View Profile
  • Peppermint version(s): Pep 8 on 386, Pep 9 on AMD 64
Re: Check to if a reboot is required.
« Reply #2 on: August 15, 2015, 09:54:00 pm »
Please for give my ignorance but with out the running of either of these useful commands what does this previously unheard of presence in /var/run do?

Regards
"Those that don't know pay for it. My currency is pride"

Offline PCNetSpec

  • Administrator
  • Hero
  • *****
  • Posts: 26452
  • Karma: 65531
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
  • Peppermint version(s): Peppermint 10
Re: Check to if a reboot is required.
« Reply #3 on: August 16, 2015, 05:47:37 pm »
it doesn't "do" anything .. it's just a file that's created if an update requires a reboot to load the new version.
(more heavyweight DE's might throw up a dialog asking if you ant to reboot if/when they see that file at that location)

If you're happy to run the old version until you reboot normally, don;t worry about it .. it's generally not that important.
« Last Edit: August 16, 2015, 05:50:34 pm by PCNetSpec »
WARNING: You are logged into reality as 'root' .. logging in as 'insane' is the only safe option.

Team Peppermint
PCNetSpec