Hello Team,

We are working on a use-case, where the reboot / shutdown / poweroff of the system has to be blocked based on some X conditions.

These X conditions will get verified (may be by running scripts/service) instantly, when the reboot  / shutdown / poweroff command gets triggered.

Please, advise us on the above topic and provide pointers to any available implementation. 

Note:
For the above use-case we won't be in a position to apply the reboot-guard in advance.

Best Regards,
Suresh