run a python script everytime the computer wakes up from hibernation

一个人想着一个人 提交于 2019-12-03 17:16:04

If your kernel is configured to use APM, you should have a /etc/apm/resume.d directory where you could put some scripts executed whenever the system power state changes.

If you don't use APM (or if you don't want to be aware of this) try the /etc/pm/sleep.d or /usr/lib/pm-utils/sleep.d directories.

In every case, you could put in a script like this :

#!/bin/sh

case "$1" in
        resume)
                #Do what you need on resume
                ;;
        thaw)
                #Do what you need on thaw
                ;;
        suspend)
                #Do what you need on suspend
                ;;
        hibernate)
                #Do what you need on hibernate
                ;;
esac
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!