Skip to content

Instantly share code, notes, and snippets.

@botto
Created July 13, 2015 14:22
Show Gist options
  • Save botto/e57c97b447443b7051ef to your computer and use it in GitHub Desktop.
Save botto/e57c97b447443b7051ef to your computer and use it in GitHub Desktop.
A way to fork bash
endFork () {
reboot
exit
}
trap endFork SIGHUP SIGINT SIGTERM
chroot /rootfs/ /bin/bash /boot/to-run.sh $$ &
while true; do
sleep 2
done
@botto
Copy link
Author

botto commented Jul 13, 2015

In your to-run simply call kill -s SIGHUP $1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment