I'm working a project where I'm going to have a Pi Zero running in a headless stand alone configuration. Since I won't have a monitor and won't be online I need a way to insure that my Pi is shutdown before it's powered off. The first part is easy, I have a momentary switch I have configured to trigger a shutdown when pressed, this works really well. What I'm having issues with is a status LED to monitor OS state. I have an LED on GPIO #6 which is triggered when the OS reaches run level 4. This is the only run level I'm concerned with and my LED is working perfectly.
Where I'm running into trouble is I want the LED to remain on until the system is halted. I'm running this through rc config so I'm using a proper RC script in /etc/init.d and my links are being created correctly. What I'm seeing is that the moment I press the switch to trigger a shutdown my LED shuts off. Watching the shutdown on the console I can see that it takes 3 or 4 seconds AFTER the LED goes out before the system is really shutdown. I've tried changing when the script runs IE K09 vs K01, I've even remove the K scripts figuring that the LED will go dark when the Pi pulls voltage from the GPIOs, but nothing seems to make a difference. The LED goes dark before the system actually shuts down.
Is there a solution for me or am I shoveling against the tide? My guess is since even after removing K scripts the LED goes down first then there must be something in the shutdown process that pulls voltage from the GPIOs very early in the shutdown process. I've looked a the RC scripts and nothing jumps out at me as being responsible for disabling GPIO.