This is a follow on question to

how to trap a suspend a resume from a bash script

How do you a trap the event that occurs when you close the lid and later reopen it from a bash script?


This StackOverflow question asks a very similar thing, just not bash-specific. The accepted answer states to try a program called Sleepwatcher for which the source is available.

From reading the source it seems like this program uses the apple-specific IORegisterForSystemPower function which allows the small C-daemon to be notified by the system before the syetm goes to sleep and after it wakes back up.

There is no generic ACPI daemon on Mac OS X that I know of.

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.