sh trap handling upon reboot

This is my trap:
Code:
trap -- 'echo
echo Going down!
exit "$_CODE"' EXIT
trap -- 'echo
echo Going down!
exit "$_CODE"' HUP
trap -- 'echo
echo Going down!
exit "$_CODE"' INT
trap -- 'echo
echo Going down!
exit "$_CODE"' QUIT
trap -- 'echo
echo Going down!
exit "$_CODE"' TERM
It has been set up at script's start.
Now sh code:
Code:
echo Regular code ...
reboot

Once it hits a reboot, the trap never gets executed! :(
Advice? :stud
 
Traps are not executed while the shell is waiting for a foreground process to terminate, and a successful reboot(8)() never terminates (it eventually calls reboot(2)() which does not return control).

There is no way to access si_code or any other siginfo_t member in a shell script.
 
Back
Top