How to check if the system requires a reboot

Sometimes, you might ask yourself if the system requires a reboot. A simple way to find this is to use a command like needs-restarting

This command is part of the yum-utils package.

needs-restarting is a program that reports a list of process ids that started running before they or some component that they use were updated.

needs-restarting man
needs restarting
needs-restarting command output

An example from a web server:

root@web [~]# needs-restarting -r
Core libraries or services have been updated:
  systemd -> 219-73.el7_8.6
  glibc -> 2.17-307.el7.1

Reboot is required to ensure that your system benefits from these updates.

More information:
https://access.redhat.com/solutions/27943
root@web [~]#
-r, --reboothint	Only report whether a full reboot is required (exit code 1) or not (exit code 0).

Resources:

needs-restarting man page
yum-utils/needs-restarting.py

Leave a Reply