1SLEEP(1P)                  POSIX Programmer's Manual                 SLEEP(1P)
2
3
4

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10
11

NAME

13       sleep — suspend execution for an interval
14

SYNOPSIS

16       sleep time
17

DESCRIPTION

19       The sleep utility shall suspend execution for  at  least  the  integral
20       number of seconds specified by the time operand.
21

OPTIONS

23       None.
24

OPERANDS

26       The following operand shall be supported:
27
28       time      A  non-negative decimal integer specifying the number of sec‐
29                 onds for which to suspend execution.
30

STDIN

32       Not used.
33

INPUT FILES

35       None.
36

ENVIRONMENT VARIABLES

38       The following environment  variables  shall  affect  the  execution  of
39       sleep:
40
41       LANG      Provide  a  default  value for the internationalization vari‐
42                 ables that are unset or null. (See the Base Definitions  vol‐
43                 ume  of POSIX.1‐2008, Section 8.2, Internationalization Vari‐
44                 ables for the precedence  of  internationalization  variables
45                 used to determine the values of locale categories.)
46
47       LC_ALL    If  set  to  a non-empty string value, override the values of
48                 all the other internationalization variables.
49
50       LC_CTYPE  Determine the locale for the interpretation of  sequences  of
51                 bytes of text data as characters (for example, single-byte as
52                 opposed to multi-byte characters in arguments).
53
54       LC_MESSAGES
55                 Determine the locale that should be used to affect the format
56                 and  contents  of  diagnostic  messages  written  to standard
57                 error.
58
59       NLSPATH   Determine the location of message catalogs for the processing
60                 of LC_MESSAGES.
61

ASYNCHRONOUS EVENTS

63       If  the  sleep  utility receives a SIGALRM signal, one of the following
64       actions shall be taken:
65
66        1. Terminate normally with a zero exit status.
67
68        2. Effectively ignore the signal.
69
70        3. Provide the default behavior for signals described in the ASYNCHRO‐
71           NOUS  EVENTS  section of Section 1.4, Utility Description Defaults.
72           This could include terminating with a non-zero exit status.
73
74       The sleep utility shall take the standard action for all other signals.
75

STDOUT

77       Not used.
78

STDERR

80       The standard error shall be used only for diagnostic messages.
81

OUTPUT FILES

83       None.
84

EXTENDED DESCRIPTION

86       None.
87

EXIT STATUS

89       The following exit values shall be returned:
90
91        0    The execution was successfully suspended for at least  time  sec‐
92             onds,  or  a  SIGALRM  signal  was received. See the ASYNCHRONOUS
93             EVENTS section.
94
95       >0    An error occurred.
96

CONSEQUENCES OF ERRORS

98       Default.
99
100       The following sections are informative.
101

APPLICATION USAGE

103       None.
104

EXAMPLES

106       The sleep utility can be used to execute  a  command  after  a  certain
107       amount of time, as in:
108
109           (sleep 105; command) &
110
111       or to execute a command every so often, as in:
112
113           while true
114           do
115               command
116               sleep 37
117           done
118

RATIONALE

120       The  exit status is allowed to be zero when sleep is interrupted by the
121       SIGALRM signal because most implementations of this utility rely on the
122       arrival of that signal to notify them that the requested finishing time
123       has been successfully attained. Such implementations thus do  not  dis‐
124       tinguish  this  situation  from  the  successful completion case. Other
125       implementations are allowed to catch the signal and go  back  to  sleep
126       until the requested time expires or to provide the normal signal termi‐
127       nation procedures.
128
129       As with all other utilities that take  integral  operands  and  do  not
130       specify  subranges  of allowed values, sleep is required by this volume
131       of POSIX.1‐2008 to deal with time requests of up to 2147483647 seconds.
132       This  may mean that some implementations have to make multiple calls to
133       the delay mechanism of the underlying operating system if its  argument
134       range is less than this.
135

FUTURE DIRECTIONS

137       None.
138

SEE ALSO

140       wait
141
142       The  Base  Definitions  volume  of POSIX.1‐2008, Chapter 8, Environment
143       Variables
144
145       The System Interfaces volume of POSIX.1‐2008, alarm(), sleep()
146
148       Portions of this text are reprinted and reproduced in  electronic  form
149       from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
150       -- Portable Operating System Interface (POSIX),  The  Open  Group  Base
151       Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
152       cal and Electronics Engineers,  Inc  and  The  Open  Group.   (This  is
153       POSIX.1-2008  with  the  2013  Technical Corrigendum 1 applied.) In the
154       event of any discrepancy between this version and the original IEEE and
155       The  Open Group Standard, the original IEEE and The Open Group Standard
156       is the referee document. The original Standard can be  obtained  online
157       at http://www.unix.org/online.html .
158
159       Any  typographical  or  formatting  errors that appear in this page are
160       most likely to have been introduced during the conversion of the source
161       files  to  man page format. To report such errors, see https://www.ker
162       nel.org/doc/man-pages/reporting_bugs.html .
163
164
165
166IEEE/The Open Group                  2013                            SLEEP(1P)
Impressum