Is there a way to call a script when Ubuntu wakes up from suspend or hibernate mode?
I have a little shell script that I run automatically when I log on to my Ubuntu machine; it will set the parameters of my touchpad the way I like it. However, when Ubuntu wakes up after being hibernated or suspended, my touchpad reverts to its default state and I have to run my little script again.
Is there some way I can automate this process thus that the script will be magically called when the machine wakes up again?
First of all, you have found a bug. The user is not supposed to bother with the touchpad configuration being lost after resume. You go to Launchpad and report this bug, so that it can be properly identified and fixed.
Then, after that, go to /etc/pm/sleep.d/
and add a script that will be executed before and after suspending or hibernating. The script receives a single command-line parameter "suspend", "resume", "hibernate" or "thaw", it should inspect this argument and take the appropriate action. There should be at least one other script in that directory (99laptop-mode
) that you can use as a reference.