I have a signal handler implemented to receive the signal SIGTERM. However, I cannot find a way to determine if the SIGTERM originated from a Halt of the system. I looked at the output from the runlevel command, but it's "N N". I was hoping I'd see "3 0", where 0 is the runlevel for Halt. This is a SLES based Linux.
I looked at the setting up a sa_sigaction to get the siginfo_t pointer, but detected no si_code or si_errno (they are both 0) and the si_pid is 1, but this does not tell me that a Halt is occurring.
Does anyone know how to determine when a SIGTERM is received that a Halt of the system is occurring? Note, I want to distinguish between a Halt and a Reboot.
I looked at the setting up a sa_sigaction to get the siginfo_t pointer, but detected no si_code or si_errno (they are both 0) and the si_pid is 1, but this does not tell me that a Halt is occurring.
Does anyone know how to determine when a SIGTERM is received that a Halt of the system is occurring? Note, I want to distinguish between a Halt and a Reboot.