Don't forget that you might need to reboot because of core library updates, at least if it is glibc. (And also, services may need to be restarted after updates).
If you install the
yum-utilspackage, you can use a command calledneeds-restarting.You can use it both for checking if a full reboot is required because of kernel or core libraries updates (using the
-roption), or what services need to be restarted (using the-soption).
needs-restarting -rreturns0if reboot is not needed, and1if it is, so it is perfect to use in a script.An example:
root@server1:~> needs-restarting -r ; echo $?
Core libraries or services have been updated:
openssl-libs -> 1:1.0.1e-60.el7_3.1
systemd -> 219-30.el7_3.9
Reboot is required to ensure that your system benefits from these updates.
More information:
https://access.redhat.com/solutions/27943
1