Skip to content

Instantly share code, notes, and snippets.

@terrywang
Created October 28, 2012 21:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save terrywang/3969985 to your computer and use it in GitHub Desktop.
Save terrywang/3969985 to your computer and use it in GitHub Desktop.
kexec
#!/bin/bash
#
# runkexec
#
### BEGIN INIT INFO
# Provides: runkexec
# Required-Start:
# Required-Stop:
# Default-Stop:
# Description: Enable or disable fast system rebooting
# Short-Description: enable or disable fast system rebooting
### END INIT INFO
KV=`uname -r`
case "$1" in
start|restart|load|reload)
kexec -l --append="`cat /proc/cmdline`" --initrd=/boot/initramfs-${KV}.img \
/boot/vmlinuz-${KV}
;;
stop|unload)
kexec -u && echo "Target kexec kernel unloaded."
;;
status)
echo "Status not available for kexec."
;;
*)
echo "Usage: runkexec {start|restart|load|reload|stop|unload|status}"
exit 2
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment