Last active
December 9, 2022 17:48
-
-
Save rany2/c54df61cd3d7871e06cc92c1dd35a16a to your computer and use it in GitHub Desktop.
Fast reboots for X86 OpenWRT machines
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
#!/bin/sh | |
unset TERM | |
export LC_ALL=C | |
if [ "$__KEXEC_REBOOT_NOHUP" != "1" ] | |
then | |
SCRIPTPATH=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) | |
__KEXEC_REBOOT_NOHUP=1 nohup "$SCRIPTPATH/$(basename -- "$0")" "$@" > /dev/null 2>&1 </dev/null & | |
exit "$?" | |
fi | |
kexec --load /boot/vmlinuz --reuse-cmdline | |
for i in /etc/rc.d/K*; do | |
if [ -x "$i" ] | |
then | |
"$i" stop > /dev/null 2>&1 </dev/null | |
fi | |
done | |
kexec --exec | |
exit "$?" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment