How To Check if RHEL/AlmaLinux needs a reboot after an update

Typically you’ll need to reboot a server after an update if the Linux Kernel was updated. It is possible that services need to be restarted.

There is some good information here https://serverfault.com/questions/122178/how-can-i-check-from-the-command-line-if-a-reboot-is-required-on-rhel-or-centos

Using Yum Utilities needs-restarting

Install the needs-restarting utility

sudo dnf install -y yum-utils

Once installed, we can check if we need to reboot with

sudo needs-restarting -r

The -r option only reports if a reboot is required.

If we wanted to automatically check and reboot, we could do

sudo needs-restarting -r || sudo shutdown -r

Alternative way

We could alternatively just check the kernel version and if it is different, manually reboot the machine. Note that there could be a couple cases where the kernel didn’t update, but you still need a reboot, or services needed to be restarted View links below for more information.

LAST_KERNEL=$(rpm -q --last kernel | perl -pe 's/^kernel-(\S+).*/$1/' | head -1)
CURRENT_KERNEL=$(uname -r)

test $LAST_KERNEL = $CURRENT_KERNEL || shutdown -r

How to determine if Ubuntu Needs a Reboot after an update

Typically after a Linux Kernel update, you will want to reboot your machine to take advantage of the new kernel. But how do you know if you need to reboot?

Fortunately, there is a simple way to check.

cat /var/run/reboot-required

If it returns

*** System restart required ***

Then we should reboot the machine.

https://www.cyberciti.biz/faq/how-to-find-out-if-my-ubuntudebian-linux-server-needs-a-reboot/

Cisco, Reload in X Minutes and Canceling

Cisco’s can be rebooted with the reload command. The reload command allows you to specify how many minutes like

reload 5

to reload in 5 minutes. We can also reload at a specific time. For instance

reload 13:30

will reload the router at 1:30PM.

For a Cisco config to remain permanent, we have to “write” i.e. save the config. By default, making changes, for instance an IP address on an interface, will get wiped on a reboot or reload.

We can take advantage of this behavior to “test” changes on a Cisco router.

Example:

  1. Run the command “reload 10” to reboot the router in 10 minutes. The plan is to cancel the reload after making sure our changes work
  2. Make the needed changes to the Router.
  3. After verifying that everything is working, run the “reload cancel” command to cancel the reload
  4. Now we can run “write” to save our new config

To recap reload 10 will reload a router in 10 minutes
If we loose access to the router while making changes, once 10 minutes has expired, the router will reload, returning it to the last know working state.
The reload cancel command will cancel the reload.
write will make our config persistent across reboots/reloads

https://superuser.com/questions/1080513/cisco-router-auto-restart-in-x-seconds

Windows 10 – How to “fully” shutdown

Windows 10 by default does a hybrid shutdown which is supposed to make it quicker to start back up.

To fully shutdown you can hold the Shift key down while clicking the shutdown button.

Side note. A Restart will do a full shutdown before starting back up.

More info.

https://www.bleepingcomputer.com/forums/t/625963/details-of-shut-down-vs-restart-please/#entry4079503
https://superuser.com/questions/974553/what-does-shiftshutdown-do-in-windows-10