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