Ubuntu – Run a script after lid is opened

suspendUbuntu

I would like to run a script after my laptop lid is opened. is there anything like rc.local that is run after the laptop wakes up after suspending?

I use Ubuntu 12

(I need it because some of the systems settings are reset after the lid is closed)

Best Answer

You could try the pm-utils package.
I don't know if this is installed by default on Ubuntu.
You can then write a hook script (at e.g. /etc/pm/sleep.d/00_my_resume_hook) such as

#!/bin/sh
case "${1}" in
    hibernate)
        # nothing
    ;;
    resume|thaw)
        #your script here
    ;;
esac

I may have glossed over some essential details here.

Related Question