Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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)

share|improve this question
See this (possible duplicate) at superuser.com: "Is there a way to call a script when Ubuntu wakes up from suspend/hibernate?" – sr_ May 4 '12 at 11:14
What I didn't stress before: the answer to the linked question is valuable since it points out that this is probably a bug, you shouldn't have to work around this. – sr_ May 4 '12 at 14:03
up vote 4 down vote accepted

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

case "${1}" in
        # nothing
        #your script here

I may have glossed over some essential details here.

share|improve this answer
I'd recommend using the /etc/acpi/handler.sh script. – user13742 May 4 '12 at 14:23
So I have /etc/acpi/powerbtn.sh, but not /etc/acpi/handler.sh. Is this just something I fill out? Any more information regarding this? – Ehtesh Choudhury Apr 2 '13 at 21:38

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.