1*66868Sbostic.\" Copyright (c) 1990, 1993, 1994 260719Sbostic.\" The Regents of the University of California. All rights reserved. 319469Smckusick.\" 450206Sbostic.\" This code is derived from software contributed to Berkeley by 550206Sbostic.\" the Institute of Electrical and Electronics Engineers, Inc. 650206Sbostic.\" 750632Scael.\" %sccs.include.redist.roff% 843736Scael.\" 9*66868Sbostic.\" @(#)sleep.1 8.3 (Berkeley) 04/18/94 1044957Scael.\" 1144957Scael.Dd 1244957Scael.Dt SLEEP 1 1347314Scael.Os 1444957Scael.Sh NAME 1544957Scael.Nm sleep 1644957Scael.Nd suspend execution for an interval of time 1744957Scael.Sh SYNOPSIS 1844957Scael.Nm sleep 1944957Scael.Ar seconds 2044957Scael.Sh DESCRIPTION 2144957ScaelThe 2244957Scael.Nm sleep 2344957Scaelcommand 2444957Scaelsuspends execution for a minimum of 2544957Scael.Ar seconds . 2644957Scael.Nm Sleep 2744957Scaelis used to schedule the execution of other commands (see 2850632Scael.Sx EXAMPLES 2950632Scaelbelow). 3044957Scael.Pp 3144957ScaelThe 3244957Scael.Nm Sleep 3344957Scaelutility exits with one of the following values: 3450632Scael.Bl -tag -width flag 3550632Scael.It Li \&0 36*66868SbosticOn successful completion, or if the signal 3750632Scael.Dv SIGALRM 3850632Scaelwas received. 3950632Scael.It Li \&>\&0 4044957ScaelAn error occurred. 4150632Scael.El 4244957Scael.Sh EXAMPLES 4344957ScaelTo schedule the execution of a command for 4444957Scael.Va x 4544957Scaelnumber seconds later: 4644957Scael.Pp 4744957Scael.Dl (sleep 1800; sh command_file >& errors)& 4844957Scael.Pp 4944957ScaelThis incantation would wait a half hour before 5044957Scaelrunning the script command_file. (See the 5144957Scael.Xr at 1 5244957Scaelutility.) 5344957Scael.Pp 5444957ScaelTo reiteratively run a command (with the 5544957Scael.Xr csh 1 ) : 5644957Scael.Pp 5750632Scael.Bd -literal -offset indent -compact 5844957Scaelwhile (1) 5944957Scael if (! -r zzz.rawdata) then 6044957Scael sleep 300 6144957Scael else 6244957Scael foreach i (`ls *.rawdata`) 6344957Scael sleep 70 6444957Scael awk -f collapse_data $i >> results 6544957Scael end 6644957Scael break 6744957Scael endif 6844957Scaelend 6950632Scael.Ed 7044957Scael.Pp 7144957ScaelThe scenario for a script such as this might be: a program currently 7244957Scaelrunning is taking longer than expected to process a series of 7344957Scaelfiles, and it would be nice to have 7444957Scaelanother program start processing the files created by the first 7544957Scaelprogram as soon as it is finished (when zzz.rawdata is created). 7644957ScaelThe script checks every five minutes for the file zzz.rawdata, 7744957Scaelwhen the file is found, then another portion processing 7865227Smckusickis done courteously by sleeping for 70 seconds in between each 7944957Scaelawk job. 8044957Scael.Sh SEE ALSO 8144957Scael.Xr setitimer 2 , 8244957Scael.Xr alarm 3 , 8344957Scael.Xr sleep 3 , 8444957Scael.Xr at 1 8544957Scael.Sh STANDARDS 8650632ScaelThe 8750632Scael.Nm sleep 8850632Scaelcommand is expected to be 8950632Scael.St -p1003.2 9050632Scaelcompatible. 91