Python detect linux shutdown and run a command before shutting down

前端 未结 2 1526
失恋的感觉
失恋的感觉 2021-01-13 08:39

Is it possible to detect and interrupt linux (Ubuntu 16.04) shutdown signal (e.g. power button clicked or runs out of battery). I have a python application that is always re

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-13 08:59

    Look into this Basically, put a script in /etc/rc0.d/ with the right name and execute a call to you python script.

提交回复
热议问题