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

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?

share|improve this question
up vote 1 down vote accepted

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.

share|improve this answer

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.