CentOS RHEL – reboot after kernel update or if reboot needed

05. December 2017 CentOS, RHEL, SysAdmin 0
CentOS RHEL – reboot after kernel update or if reboot needed

Yum-Cron

Yum-cron is used to update the server automatically. This service will update the server with all the packages or only the security patches as configured on /etc/yum/yum-cron.conf

But, the yum-cron lack in reboot feature. If any packages, say kernel, glibc or gcc require a reboot of the server then we have to do the reboot manually.

 

Solution

We can solve this issue by adding a simple cron to the server. This cron will check if any package requires reboot of the server, below is the cron command and the cron.

0 5 * * * /usr/bin/needs-restarting -r || shutdown -r


Leave a Reply

Your email address will not be published. Required fields are marked *