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