Skip to content

Instantly share code, notes, and snippets.

@arter97
Last active November 29, 2022 22:29
Show Gist options
  • Save arter97/561b9cd5ccbbbcaee11498874f46b8e4 to your computer and use it in GitHub Desktop.
Save arter97/561b9cd5ccbbbcaee11498874f46b8e4 to your computer and use it in GitHub Desktop.
kexec reboot helper for Ubuntu
#!/bin/bash
# Store at /usr/local/sbin/reboot with 755 permission
echo ""
echo "Using kexec for faster reboot."
echo ""
echo "If you want to perform a full reboot,"
echo "use 'systemctl reboot' instead."
echo ""
sudo kexec \
-l $(ls /boot/vmlinuz-* | sort -V | tail -n1) \
--initrd=$(ls /boot/vmlinuz-* | sort -V | tail -n1 | sed s/vmlinuz/initrd.img/g) \
--reuse-cmdline && sudo systemctl kexec
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment