6

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)

5

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.

  • I'd recommend using the /etc/acpi/handler.sh script. – user13742 May 4 '12 at 14:23
  • 1
    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 clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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