I know that the packagekit GUI can inform the user that a reboot is necessary after an update. But is there a yum switch I can turn on, or another terminal command I can use, to know whether a reboot is necessary? (After all, packagekit must be getting its information somehow.)
Thanks in advance.
22 Answers
Kernel updates will require a reboot to take effect. There's a bash script at How can I check from the command line if a reboot is required on RHEL or CentOS? for checking if a reboot is needed because an update to the kernel has been installed. See Re: How do you know when a reboot is required after yum update? for reasons a reboot is usually not required for other updates.
@moonpoint is right that kernel updates will require a reboot to take affect. However in any case if you are about to fix a Bug, Vulnerability or performance enhancement in any package, typically that will need a system reboot(or at least the service reboot) to be patched properly.
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. This package is part of yum-utils and works perfect on Red Hat Distribution Versions 6 and 7.
Below is the sample after running a yum upgrade and goferd service being upgraded which requires the service restart to complete the upgrade process.
[root]# needs-restarting
1161 : python /usr/bin/goferd --foregroundAfter restarting the service
[root]# service goferd restart
Redirecting to /bin/systemctl restart goferd.service
[root]# needs-restarting
[root]# 1