NOSLEEP(1) CYGWIN NOSLEEP(1)NAMEnosleep - Run a program while inhibiting computer sleep or hibernation
SYNOPSISnosleep [OPTIONS] command [args]
DESCRIPTIONnosleep runs the supplied command, command [args], while inhibiting the
computer from sleeping or hibernating until the command finishes exe‐
cuting.
nosleep does not guarantee that the computer won't go to sleep. By
default, it just prevents the computer from automatically putting
itself to sleep during periods of no user input (although it still
allows the display to turn off). If the user closes the laptop lid or
presses the power button, the computer will still behave as its power
management plan dictates--typically by sleeping, hibernating, or shut‐
ting down.
Inhibiting idle sleep is a safe mode of operation, since it won't pre‐
vent the computer from shutting down if needs to to conserve power, and
for many applications this mode is sufficient. When it's not, options
are available, below, to more aggressively inhibit sleep or hiberna‐
tion. But before you use any of them, you must read the:
WARNINGS AND DISCLAIMER
Aggressively inhibiting sleep or hibernation carries at least the fol‐
lowing disadvantages and risks:
1. If the host is running on battery, preventing sleep, hiberna‐
tion, or display shutoff could cause the host to run out of
power and shut down uncleanly, potentially causing data loss.
2. Users may become confused or frustrated if the usual sleep
behavior that they expect, such as going to sleep when the lap‐
top lid is closed, stops working or only works some of the time.
3. nosleep still can't guarantee that the command will complete,
since it can't prevent users or other processes from shutting
down the host. For example, a user who tries and fails to put
the computer to sleep may decide to shut it down instead.
The author disclaims all responsibility for any losses you may incur by
using the more aggressive options below.
OPTIONS--awaymode
Make the computer go into "away mode" when it would normally go
to sleep. The computer will appear to be asleep, but the com‐
mand will continue executing. The Windows documentation[1]
says: "Applications that do not require critical background pro‐
cessing or that run on portable computers should not enable away
mode because it prevents the system from conserving power by
entering true sleep." Use your power for good, not evil.
Away mode is only available if it's allowed by the active power
plan, and there is no direct way for the user to determine if
this is the case. For more information see the section "Away
Mode and Windows Vista Power Policy" in [2].
Windows Server 2003 and Windows XP/2000: Away mode is not sup‐
ported. This option will have no effect.
--display
Prevent the display from dimming or turning off during idle
periods.
--ifacpower
Options that follow this one will only take effect if the host
is running on AC power. The AC power state is only checked when
nosleep starts; if AC power is removed after that, nosleep won't
detect it.
EXAMPLESnosleep rsync dir1 dir2
will run rsync dir1 dir2, preventing idle sleep until rsync exits.
nosleep--ifacpower --display rsync dir1 dir2
will prevent idle sleep as before, and will also keep the display from
turning off if the computer is running on AC power when nosleep starts.
RETURN VALUEnosleep returns the exit value of command, or 128 if it encounters a
fatal error.
BUGS
Please send bug reports to the Cygwin mailing list <cygwin@cygwin.com>.
REFERENCES
[1] http://msdn.microsoft.com/en-us/library/aa373208(VS.85).aspx
[2] http://download.microsoft.com/down‐
load/9/c/5/9c5b2167-8017-4bae-9fde-d599bac8184a/AwayMode.doc
AUTHOR
Andrew E. Schulman <schulman.andrew@epa.gov>
0.1 Sep 20, 2011 NOSLEEP(1)