Commit | Line | Data |
---|---|---|
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 | |
18 | The | |
19 | .Nm sleep | |
20 | command | |
21 | suspends execution for a minimum of | |
22 | .Ar seconds . | |
23 | .Nm Sleep | |
24 | is used to schedule the execution of other commands (see | |
25 | EXAMPLES below). | |
26 | .Pp | |
27 | The | |
28 | .Nm Sleep | |
29 | utility exits with one of the following values: | |
30 | .Tw Ds | |
31 | .Tp Li \&0 | |
32 | On successful completetion, or if the signal SIGALRM was received. | |
33 | .Tp Li \&>\&0 | |
34 | An error occurred. | |
35 | .Tp | |
36 | .Sh EXAMPLES | |
37 | To schedule the execution of a command for | |
38 | .Va x | |
39 | number seconds later: | |
40 | .Pp | |
41 | .Dl (sleep 1800; sh command_file >& errors)& | |
42 | .Pp | |
43 | This incantation would wait a half hour before | |
44 | running the script command_file. (See the | |
45 | .Xr at 1 | |
46 | utility.) | |
47 | .Pp | |
48 | To reiteratively run a command (with the | |
49 | .Xr csh 1 ) : | |
50 | .Pp | |
51 | .Ds I | |
52 | while (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 | |
62 | end | |
63 | .De | |
64 | .Pp | |
65 | The scenario for a script such as this might be: a program currently | |
66 | running is taking longer than expected to process a series of | |
67 | files, and it would be nice to have | |
68 | another program start processing the files created by the first | |
69 | program as soon as it is finished (when zzz.rawdata is created). | |
70 | The script checks every five minutes for the file zzz.rawdata, | |
71 | when the file is found, then another portion processing | |
72 | is done curteously by sleeping for 70 seconds in between each | |
73 | awk job. | |
74 | .Sh SEE ALSO | |
75 | .Xr setitimer 2 , | |
76 | .Xr alarm 3 , | |
77 | .Xr sleep 3 , | |
78 | .Xr at 1 | |
79 | .Sh STANDARDS | |
80 | The sleep function is expected to be POSIX 1003.2 compatible. |