How to detect pending system shutdown on Linux?

前端 未结 9 1086
死守一世寂寞
死守一世寂寞 2020-12-05 14:37

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

9条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-05 15:22

    When the system shuts down, the rc.d scripts are called.

    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.

提交回复
热议问题