Cynosure.X International LLC

Wiki: SleepWatcher

Attach | Edit | Revisions
Related Content

SleepWatcher Man Page

sleepwatcher(8)           BSD System Manager's Manual          sleepwatcher(8)

NAME
     sleepwatcher -- daemon to monitor sleep, wakeup and idleness of a Mac

SYNOPSIS
     sleepwatcher [-n] [-v] [-V] [-d] [-g] [-f configfile] [-p pidfile]
                  [-a[allowsleepcommand]] [-s sleepcommand] [-w wakeupcommand]
                  [-D displaydimcommand] [-E displayundimcommand]
                  [-S displaysleepcommand] [-W displaywakeupcommand]
                  [-t timeout] [-i idlecommand]

DESCRIPTION
     sleepwatcher is a program that monitors sleep, wakeup and idleness of a
     Mac.  It can be used to execute a Unix command when the Mac or the dis-
     play of the Mac goes to sleep mode or wakes up or after a given time
     without user interaction.  It also can send the Mac to sleep mode or
     retrieve the time since last user activity.

     Command line options:

     -n, --now
              Sleep now and exit, ignoring other options.

     -v, --version
              Display version and copyright information and exit.

     -V, --verbose
              Log any action sleepwatcher performs, either to stdout or, when
              running as daemon, to the syslog.

     -d, --daemon
              Run as background daemon.

     -g, --getidletime
              Write the time (in 0.1 seconds) of no keyboard or mouse activity
              and exit, ignoring other options.

     -f configfile, --config configfile
              Read additional configuration options from configfile.  config-
              file contains options in the form option [ = value ] where
              option is one of the long command line options (without --).
              sleepwatcher rereads its configuration file when it receives a
              hangup signal, SIGHUP.

     -p pidfile, --pidfile pidfile
              Write the process id of sleepwatcher to pidfile.

     -a[allowsleepcommand], --allowsleep[=allowsleepcommand]
              Allow the Mac to idle sleep only when allowsleepcommand returns
              a zero exit code. Without allowsleepcommand, this option pre-
              vents idle sleep at all. (Note: no space after the -a.)

     -s sleepcommand, --sleep sleepcommand
              Execute sleepcommand when the Mac is put to sleep mode.  sleep-
              command must not take longer than 15 seconds because after this
              timeout the sleep mode is forced by the system.

     -w wakeupcommand, --wakeup wakeupcommand
              Execute wakeupcommand when the Mac wakes up from sleep mode.

     -D displaydimcommand, --displaydim displaydimcommand
              Execute displaydimcommand when the display of the Mac is dimmed.
              Note that the displaydimcommand is executed when the Mac goes to
              sleep mode, too.

     -E displayundimcommand, --displayundim displayundimcommand
              Execute displayundimcommand when the display of the Mac is
              undimmed without having gone to sleep.  Note that the dis-
              playundimcommand is not executed when the Mac or the display of
              the Mac wakes up from sleep mode.

     -S displaysleepcommand, --displaysleep displaysleepcommand
              Execute displaysleepcommand when the display of the Mac is put
              to sleep mode.

     -W displaywakeupcommand, --displaywakeup displaywakeupcommand
              Execute displaywakeupcommand when the display of the Mac wakes
              up from sleep mode.  Note that the displaywakeupcommand is exe-
              cuted when the Mac wakes up from sleep mode, too.

     -t timeout, --timeout timeout
              Set the timeout (in 0.1 seconds) for the -i option, i. e. exe-
              cute the idlecommand after this time of no user interactivity.

     -i idlecommand, --idle idlecommand
              Execute idlecommand after the time of no user interactivity set
              with the -t option.

SEE ALSO
     SystemStarter(8), launchd(8), pmset(1)

BUGS
     Any user with execute permission for sleepwatcher can send the Mac to
     sleep mode with the -n option, making the system unavailable for other
     (remote) users.

     For compatibility with Mac OS X 10.3 and earlier, sleepwatcher is a clas-
     sical daemon and therefore not compliant with launchd of Mac OS X 10.4
     and later. It should be launched by a SystemStarter startup item.

ACKNOWLEDGEMENTS
     Thanks to Daniel Griscom for the idea and code for the deny sleep fea-
     ture.  Thanks to Darren Creutz for the idea and code for the display
     sleep support.  And thanks to Michael Lee for the ideas for idleness han-
     dling within sleepwatcher.

Darwin                         November 18, 2008                        Darwin

Comments & Discussion >>

Related Links

Attach | Edit | Revisions
Related Content

Products | Services
Forums | Latest | RSS
Library | Search | Wiki
Help | Licenses

Login | Register

203 Users Online

Hacking Digital Cameras
Fun for Photographers


Get Our

Memecoins!



Amazon Associate

Copyright © 1996 - 2024. All Rights Reserved.