I am the developer of the PCDM login manager for the PC-BSD project, and I am trying to set[ ]up PCDM to be able to detect when the system is getting ready to shutdown/restart to make sure that it doesn't restart X again.
I am already checking for the existance of /var/run/nologin, but that was still not catching about 90% of the shutdown/restart processes from the various desktop environments (I am testing KDE, MATE, GNOME3, Cinnamon, Xfce, LXDE). I then added an additional check (using pgrep) for the "shutdown", "reboot", and "halt" processes but that is not having any luck either.
Is there any other method for checking whether the system is scheduled for a shutdown/restart? I am not sure how the DE's are triggering the system event, so I am looking for a general method that should always work (in theory).
I am already checking for the existance of /var/run/nologin, but that was still not catching about 90% of the shutdown/restart processes from the various desktop environments (I am testing KDE, MATE, GNOME3, Cinnamon, Xfce, LXDE). I then added an additional check (using pgrep) for the "shutdown", "reboot", and "halt" processes but that is not having any luck either.
Is there any other method for checking whether the system is scheduled for a shutdown/restart? I am not sure how the DE's are triggering the system event, so I am looking for a general method that should always work (in theory).