'\" te .\" Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved. .\" Copyright 1989 AT&T .\" Portions Copyright (c) 1982-2007 AT&T Knowledge Ventures .\" Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at http://www.opengroup.org/bookstore/. .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html. This notice shall appear on any product containing this material. .TH sleep 1 "28 Jul 2011" "SunOS 5.11" "User Commands" .SH NAME sleep \- suspend execution for an interval .SH SYNOPSIS .LP .nf \fB/usr/bin/sleep\fR \fIinterval\fR[\fBd|h|m|s\fR]... .fi .SH DESCRIPTION .sp .LP \fBsleep\fR suspends execution for at least the time in seconds specified by \fIseconds\fR or until a \fBSIGALRM\fR signal is received. The \fIseconds\fR operand can be specified as a floating point number but the actual granularity normally depends on the underlying system. .SH OPERANDS .sp .ne 2 .mk .na \fB\fIinterval\fR\fR .ad .RS 12n .rt A floating-point number specifying the time for which to suspend execution. The floating-point number may be specified in all formats required by C99/XPG6, including constants such as \fBInf\fR or \fBinfinite\fR. One of four suffixes may optionally be specified, indicating the number specified is days (\fBd\fR), hours (\fBh\fR), minutes (\fBm\fR), or seconds (\fBs\fR). With no suffix, the interval is assumed to be seconds. If multiple intervals are specified they are summed together. Individual intervals may be negative but the sum must be greater than or equal to zero. .RE .SH EXAMPLES .LP \fBExample 1 \fRSuspending Command Execution .sp .LP The following example executes a command after a certain amount of time: .sp .in +2 .nf example% \fB(sleep 105; \fIcommand\fR)&\fR .fi .in -2 .sp .LP \fBExample 2 \fRExecuting a Command Every So Often .sp .LP The following example executes a command every so often: .sp .in +2 .nf example% \fBwhile true do \fIcommand\fR sleep 37 done\fR .fi .in -2 .sp .LP \fBExample 3 \fRSuspending Command Execution Forever .sp .LP The following example suspends command execution forever or until a \fBSIGALRM\fR signal is received: .sp .in +2 .nf example% sleep Inf .fi .in -2 .sp .LP \fBExample 4 \fRSuspending Command Execution for 0.5 Seconds .sp .LP Suspending command execution for 0.5 seconds using an alternative floating-point representation for the value \fB0.5\fR: .sp .in +2 .nf example% printf "%a\en" 0.5 0x1.0000000000000000000000000000p-01 .fi .in -2 .sp .sp .in +2 .nf example% sleep 0x1.0000000000000000000000000000p-01 .fi .in -2 .sp .LP \fBExample 5 \fRSuspending Execution for 23 Hours .sp .LP The following example suspends execution for twenty three hours using a letter suffixes: .sp .in +2 .nf example% sleep 1d -1h .fi .in -2 .sp .SH ENVIRONMENT VARIABLES .sp .LP See \fBenviron\fR(5) for descriptions of the following environment variables that affect the execution of \fBsleep\fR: \fBLANG\fR, \fBLC_ALL\fR, \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, and \fBNLSPATH\fR. .SH EXIT STATUS .sp .LP The following exit values are returned: .sp .ne 2 .mk .na \fB\fB0\fR\fR .ad .RS 6n .rt The execution was successfully suspended for at least \fItime\fR seconds, or a \fBSIGALRM\fR signal was received (see NOTES). .RE .sp .ne 2 .mk .na \fB\fB>0\fR\fR .ad .RS 6n .rt An error has occurred. .RE .SH ATTRIBUTES .sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp .sp .TS tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) . ATTRIBUTE TYPEATTRIBUTE VALUE _ Availabilitysystem/core-os _ Interface StabilityCommitted _ StandardSee \fBstandards\fR(5). .TE .SH SEE ALSO .sp .LP \fBwait\fR(1), \fBalarm\fR(2), \fBsleep\fR(3C), \fBattributes\fR(5), \fBenviron\fR(5), \fBstandards\fR(5) .SH NOTES .sp .LP If the \fBsleep\fR utility receives a \fBSIGALRM\fR signal, one of the following actions is taken: .RS +4 .TP .ie t \(bu .el o Terminate normally with a zero exit status. .RE .RS +4 .TP .ie t \(bu .el o Effectively ignore the signal. .RE .sp .LP The \fBsleep\fR utility takes the standard action for all other signals.