SleepWatcher is a command line tool (daemon) for Mac OS X that monitors sleep, wakeup and idleness of a Mac. It can be used to execute a Unix command when the Mac or the display of the Mac goes to sleep mode or wakes up, after a given time without user interaction or when the user resumes activity after a break or when the power supply of a Mac notebook is attached or detached. It also can send the Mac to sleep mode or retrieve the time since last user activity.
A little bit knowledge of the Unix command line is required to benefit from this software.
The current version removes the installer packages and requires manual installation. This hopefully prevents people without sufficient Unix knowledge to install this software. SleepWatcher is published under the GNU General Public License.
What's new in version 2.2
added the -c cantsleepcommand and -R idleresumecommand options