Last active
February 3, 2021 09:52
-
-
Save sempr/7109d7bafa6a956e0db89261e8ae50d7 to your computer and use it in GitHub Desktop.
使用kexec来替换新内核
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
latestkernel=`ls -t /boot/vmlinuz-* | sed "s/\/boot\/vmlinuz-//g" | head -n1` | |
echo $latestkernel | |
kexec -l /boot/vmlinuz-${latestkernel} --initrd=/boot/initramfs-${latestkernel}.img --append="`cat /proc/cmdline`" | |
kexec -e | |
# 备注,其实和重启没啥两样, uptime也会清零重算,唯一的好处就是比重启要快一点点 | |
# remove old kernels on centos 8 | |
dnf remove --oldinstallonly --setopt installonly_limit=1 kernel |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment