Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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
2  
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

1 Answer 1

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

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

I may have glossed over some essential details here.

share|improve this answer
    
I'd recommend using the /etc/acpi/handler.sh script. –  Herman Torjussen 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? –  Shurane Apr 2 '13 at 21:38

Your Answer

 
discard

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.