Move everything from /var/adm to /var/log
[unleashed.git] / share / man / man1 / sleep.1
blob4b901947073819e6256c2f3f42f48b7e62551966
1 .\"
2 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for
3 .\" permission to reproduce portions of its copyrighted documentation.
4 .\" Original documentation from The Open Group can be obtained online at
5 .\" http://www.opengroup.org/bookstore/.
6 .\"
7 .\" The Institute of Electrical and Electronics Engineers and The Open
8 .\" Group, have given us permission to reprint portions of their
9 .\" documentation.
10 .\"
11 .\" In the following statement, the phrase ``this text'' refers to portions
12 .\" of the system documentation.
13 .\"
14 .\" Portions of this text are reprinted and reproduced in electronic form
15 .\" in the SunOS Reference Manual, from IEEE Std 1003.1, 2004 Edition,
16 .\" Standard for Information Technology -- Portable Operating System
17 .\" Interface (POSIX), The Open Group Base Specifications Issue 6,
18 .\" Copyright (C) 2001-2004 by the Institute of Electrical and Electronics
19 .\" Engineers, Inc and The Open Group.  In the event of any discrepancy
20 .\" between these versions and the original IEEE and The Open Group
21 .\" Standard, the original IEEE and The Open Group Standard is the referee
22 .\" document.  The original Standard can be obtained online at
23 .\" http://www.opengroup.org/unix/online.html.
24 .\"
25 .\" This notice shall appear on any product containing this material.
26 .\"
27 .\" The contents of this file are subject to the terms of the
28 .\" Common Development and Distribution License (the "License").
29 .\" You may not use this file except in compliance with the License.
30 .\"
31 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
32 .\" or http://www.opensolaris.org/os/licensing.
33 .\" See the License for the specific language governing permissions
34 .\" and limitations under the License.
35 .\"
36 .\" When distributing Covered Code, include this CDDL HEADER in each
37 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
38 .\" If applicable, add the following below this CDDL HEADER, with the
39 .\" fields enclosed by brackets "[]" replaced with your own identifying
40 .\" information: Portions Copyright [yyyy] [name of copyright owner]
41 .\"
42 .\"
43 .\" Copyright 1989 AT&T
44 .\" Portions Copyright (c) 1992, X/Open Company Limited  All Rights Reserved
45 .\" Portions Copyright (c) 1982-2007 AT&T Knowledge Ventures
46 .\" Copyright (c) 2007, Sun Microsystems, Inc.  All Rights Reserved  Portions
47 .\"
48 .TH SLEEP 1 "May 13, 2017"
49 .SH NAME
50 sleep \- suspend execution for an interval
51 .SH SYNOPSIS
52 .SS "/usr/bin/sleep"
53 .LP
54 .nf
55 \fB/usr/bin/sleep\fR \fIseconds\fR
56 .fi
58 .SS "ksh93"
59 .LP
60 .nf
61 \fBsleep\fR \fIseconds\fR
62 .fi
64 .SH DESCRIPTION
65 .LP
66 \fBsleep\fR suspends execution for at least the time in seconds specified by
67 \fIseconds\fR or until a \fBSIGALRM\fR signal is received. The \fIseconds\fR
68 operand can be specified as a floating point number but the actual granularity
69 normally depends on the underlying system.
70 .SH OPERANDS
71 .SS "/usr/bin/sleep"
72 .LP
73 The following operands are supported for \fB/usr/bin/sleep\fR and \fBksh93\fR's
74 \fBsleep\fR built-in command:
75 .sp
76 .ne 2
77 .na
78 \fB\fIseconds\fR\fR
79 .ad
80 .RS 11n
81 A non-negative floating-point number specifying the number of seconds for which
82 to suspend execution. The floating-point number may be specified in all formats
83 required by C99/XPG6, including constants such as "Inf" or "infinity".
84 .RE
86 .SS "ksh93"
87 .LP
88 The following operands are supported:
89 .sp
90 .ne 2
91 .na
92 \fB\fItime\fR\fR
93 .ad
94 .RS 8n
95 Specify \fItime\fR in seconds as a floating point number. The actual
96 granularity depends on the underlying system, normally around 1 millisecond.
97 .RE
99 .SH EXAMPLES
101 \fBExample 1 \fRSuspending Command Execution
104 The following example executes a command after a certain amount of time:
107 .in +2
109 example% \fB(sleep 105; \fIcommand\fR)&\fR
111 .in -2
115 \fBExample 2 \fRExecuting a Command Every So Often
118 The following example executes a command every so often:
121 .in +2
123 example% \fBwhile true
125         \fIcommand\fR
126         sleep 37
127 done\fR
129 .in -2
133 \fBExample 3 \fRSuspend command execution forever (or until a \fBSIGALRM\fR
134 signal is received)
136 .in +2
138 example% sleep Inf
140 .in -2
144 \fBExample 4 \fRSuspending command execution for 0.5 seconds
147 Suspending command execution for 0.5 seconds using an alternative
148 floating-point representation for the value "0.5"
151 .in +2
153 example% printf "%a\en" 0.5
154 0x1.0000000000000000000000000000p-01
156 .in -2
160 .in +2
162 example% sleep 0x1.0000000000000000000000000000p-01
164 .in -2
167 .SH ENVIRONMENT VARIABLES
169 See \fBenviron\fR(5) for descriptions of the following environment variables
170 that affect the execution of \fBsleep\fR: \fBLANG\fR, \fBLC_ALL\fR,
171 \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, and \fBNLSPATH\fR.
172 .SH EXIT STATUS
174 The following exit values are returned:
176 .ne 2
178 \fB\fB0\fR\fR
180 .RS 6n
181 The execution was successfully suspended for at least \fItime\fR seconds, or a
182 \fBSIGALRM\fR signal was received (see NOTES).
186 .ne 2
188 \fB\fB>0\fR\fR
190 .RS 6n
191 An error has occurred.
194 .SH ATTRIBUTES
196 See \fBattributes\fR(5) for descriptions of the following attributes:
197 .SS "/usr/bin/sleep"
199 box;
200 c | c
201 l | l .
202 ATTRIBUTE TYPE  ATTRIBUTE VALUE
204 Interface Stability     Committed
206 Standard        See \fBstandards\fR(5).
209 .SS "ksh93"
211 box;
212 c | c
213 l | l .
214 ATTRIBUTE TYPE  ATTRIBUTE VALUE
216 Interface Stability     Uncommitted
219 .SH SEE ALSO
221 \fBksh93\fR(1), \fBwait\fR(1), \fBalarm\fR(2), \fBsleep\fR(3C),
222 \fBattributes\fR(5), \fBenviron\fR(5), \fBstandards\fR(5)
223 .SH NOTES
225 If the \fBsleep\fR utility receives a \fBSIGALRM\fR signal, one of the
226 following actions is taken:
227 .RS +4
229 .ie t \(bu
230 .el o
231 Terminate normally with a zero exit status.
233 .RS +4
235 .ie t \(bu
236 .el o
237 Effectively ignore the signal.
241 The \fBsleep\fR utility takes the standard action for all other signals.
244 The behavior for input values such as "NaN" (not-a-number) or negative values
245 is undefined.