Friday, February 9, 2024

How to upgrade the linux kernel on every month ubuntu/redhat

vi kernel_update.sh chmod +x kernel_update.sh #!/bin/bash # Update package lists sudo apt update # Upgrade the Linux kernel sudo apt upgrade -y linux-image-generic linux-headers-generic # Reboot the system to apply the new kernel sudo reboot crontab -e 0 0 1 * * /home/kernel_update.sh For Redhat/Centos vi kernel_update.sh chmod +x kernel_update.sh #!/bin/bash # Update package lists sudo yum check-update # Upgrade the Linux kernel sudo yum update kernel -y # Reboot the system to apply the new kernel sudo reboot crontab -e 0 0 1 * * /home/kernel_update.sh Note: We can call the script from ansible also every month. --- - hosts: All become: yes tasks: - name: Kernal upgrade script as Cron job cron: user: "root" day: "1" hour: "00" minute: "00" name: "Kernal upgrade script as Cron job" job: "/home/kernel_update.sh /tmp/lupdate.log"

No comments:

Post a Comment