add .Vx and unset .Os
[unix-history] / usr / src / bin / sleep / sleep.1
CommitLineData
5325ced3
CL
1.\" Copyright (c) 1990 The Regents of the University of California.
2.\" All rights reserved.
1039c22a 3.\"
5325ced3 4.\" %sccs.include.redist.man%
daacd5f0 5.\"
d0719240 6.\" @(#)sleep.1 6.4 (Berkeley) %G%
5325ced3
CL
7.\"
8.Dd
9.Dt SLEEP 1
10.Os BSD 4.4
11.Sh NAME
12.Nm sleep
13.Nd suspend execution for an interval of time
14.Sh SYNOPSIS
15.Nm sleep
16.Ar seconds
17.Sh DESCRIPTION
18The
19.Nm sleep
20command
21suspends execution for a minimum of
22.Ar seconds .
23.Nm Sleep
24is used to schedule the execution of other commands (see
25EXAMPLES below).
26.Pp
27The
28.Nm Sleep
29utility exits with one of the following values:
30.Tw Ds
31.Tp Li \&0
32On successful completetion, or if the signal SIGALRM was received.
33.Tp Li \&>\&0
34An error occurred.
35.Tp
36.Sh EXAMPLES
37To schedule the execution of a command for
38.Va x
39number seconds later:
40.Pp
41.Dl (sleep 1800; sh command_file >& errors)&
42.Pp
43This incantation would wait a half hour before
44running the script command_file. (See the
45.Xr at 1
46utility.)
47.Pp
48To reiteratively run a command (with the
49.Xr csh 1 ) :
50.Pp
51.Ds I
52while (1)
53 if (! -r zzz.rawdata) then
54 sleep 300
55 else
56 foreach i (`ls *.rawdata`)
57 sleep 70
58 awk -f collapse_data $i >> results
59 end
60 break
61 endif
62end
63.De
64.Pp
65The scenario for a script such as this might be: a program currently
66running is taking longer than expected to process a series of
67files, and it would be nice to have
68another program start processing the files created by the first
69program as soon as it is finished (when zzz.rawdata is created).
70The script checks every five minutes for the file zzz.rawdata,
71when the file is found, then another portion processing
72is done curteously by sleeping for 70 seconds in between each
73awk job.
74.Sh SEE ALSO
75.Xr setitimer 2 ,
76.Xr alarm 3 ,
77.Xr sleep 3 ,
78.Xr at 1
79.Sh STANDARDS
80The sleep function is expected to be POSIX 1003.2 compatible.