Fixed bug in name concatenation.
[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.\"
ae122740
KB
4.\" This code is derived from software contributed to Berkeley by
5.\" the Institute of Electrical and Electronics Engineers, Inc.
6.\"
28c11414 7.\" %sccs.include.redist.roff%
daacd5f0 8.\"
28c11414 9.\" @(#)sleep.1 6.6 (Berkeley) %G%
5325ced3
CL
10.\"
11.Dd
12.Dt SLEEP 1
ee9b0a0a 13.Os
5325ced3
CL
14.Sh NAME
15.Nm sleep
16.Nd suspend execution for an interval of time
17.Sh SYNOPSIS
18.Nm sleep
19.Ar seconds
20.Sh DESCRIPTION
21The
22.Nm sleep
23command
24suspends execution for a minimum of
25.Ar seconds .
26.Nm Sleep
27is used to schedule the execution of other commands (see
28c11414
CL
28.Sx EXAMPLES
29below).
5325ced3
CL
30.Pp
31The
32.Nm Sleep
33utility exits with one of the following values:
28c11414
CL
34.Bl -tag -width flag
35.It Li \&0
36On successful completetion, or if the signal
37.Dv SIGALRM
38was received.
39.It Li \&>\&0
5325ced3 40An error occurred.
28c11414 41.El
5325ced3
CL
42.Sh EXAMPLES
43To schedule the execution of a command for
44.Va x
45number seconds later:
46.Pp
47.Dl (sleep 1800; sh command_file >& errors)&
48.Pp
49This incantation would wait a half hour before
50running the script command_file. (See the
51.Xr at 1
52utility.)
53.Pp
54To reiteratively run a command (with the
55.Xr csh 1 ) :
56.Pp
28c11414 57.Bd -literal -offset indent -compact
5325ced3
CL
58while (1)
59 if (! -r zzz.rawdata) then
60 sleep 300
61 else
62 foreach i (`ls *.rawdata`)
63 sleep 70
64 awk -f collapse_data $i >> results
65 end
66 break
67 endif
68end
28c11414 69.Ed
5325ced3
CL
70.Pp
71The scenario for a script such as this might be: a program currently
72running is taking longer than expected to process a series of
73files, and it would be nice to have
74another program start processing the files created by the first
75program as soon as it is finished (when zzz.rawdata is created).
76The script checks every five minutes for the file zzz.rawdata,
77when the file is found, then another portion processing
78is done curteously by sleeping for 70 seconds in between each
79awk job.
80.Sh SEE ALSO
81.Xr setitimer 2 ,
82.Xr alarm 3 ,
83.Xr sleep 3 ,
84.Xr at 1
85.Sh STANDARDS
28c11414
CL
86The
87.Nm sleep
88command is expected to be
89.St -p1003.2
90compatible.