I am working on an application where I need to detect a system shutdown. However, I have not found any reliable way get a notification on this event.
I know that o
When the system shuts down, the rc.d scripts are called.
rc.d
Maybe you can add a script there that sends some special signal to your program.
However, I doubt you can stop the system shutdown that way.