xref: /csrg-svn/bin/sleep/sleep.1 (revision 47314)
144957Scael.\" Copyright (c) 1990 The Regents of the University of California.
244957Scael.\" All rights reserved.
319469Smckusick.\"
444957Scael.\" %sccs.include.redist.man%
543736Scael.\"
6*47314Scael.\"     @(#)sleep.1	6.4 (Berkeley) 03/14/91
744957Scael.\"
8*47314Scael.Vx
9*47314Scael.Vx
1044957Scael.Dd
1144957Scael.Dt SLEEP 1
12*47314Scael.Os
1344957Scael.Sh NAME
1444957Scael.Nm sleep
1544957Scael.Nd suspend execution for an interval of time
1644957Scael.Sh SYNOPSIS
1744957Scael.Nm sleep
1844957Scael.Ar seconds
1944957Scael.Sh DESCRIPTION
2044957ScaelThe
2144957Scael.Nm sleep
2244957Scaelcommand
2344957Scaelsuspends execution for a minimum of
2444957Scael.Ar seconds .
2544957Scael.Nm Sleep
2644957Scaelis used to schedule the execution of other commands (see
2744957ScaelEXAMPLES below).
2844957Scael.Pp
2944957ScaelThe
3044957Scael.Nm Sleep
3144957Scaelutility exits with one of the following values:
3244957Scael.Tw Ds
3344957Scael.Tp Li \&0
3444957ScaelOn successful completetion, or if the signal SIGALRM was received.
3544957Scael.Tp Li \&>\&0
3644957ScaelAn error occurred.
3744957Scael.Tp
3844957Scael.Sh EXAMPLES
3944957ScaelTo schedule the execution of a command for
4044957Scael.Va x
4144957Scaelnumber seconds later:
4244957Scael.Pp
4344957Scael.Dl (sleep 1800; sh command_file >& errors)&
4444957Scael.Pp
4544957ScaelThis incantation would wait a half hour before
4644957Scaelrunning the script command_file. (See the
4744957Scael.Xr at 1
4844957Scaelutility.)
4944957Scael.Pp
5044957ScaelTo reiteratively run a command (with the
5144957Scael.Xr csh 1 ) :
5244957Scael.Pp
5344957Scael.Ds I
5444957Scaelwhile (1)
5544957Scael	if (! -r zzz.rawdata) then
5644957Scael		sleep 300
5744957Scael	else
5844957Scael		foreach i (`ls *.rawdata`)
5944957Scael			sleep 70
6044957Scael			awk -f collapse_data $i >> results
6144957Scael		end
6244957Scael		break
6344957Scael	endif
6444957Scaelend
6544957Scael.De
6644957Scael.Pp
6744957ScaelThe scenario for a script such as this might be: a program currently
6844957Scaelrunning is taking longer than expected to process a series of
6944957Scaelfiles, and it would be nice to have
7044957Scaelanother program start processing the files created by the first
7144957Scaelprogram as soon as it is finished (when zzz.rawdata is created).
7244957ScaelThe script checks every five minutes for the file zzz.rawdata,
7344957Scaelwhen the file is found, then another portion processing
7444957Scaelis done curteously by sleeping for 70 seconds in between each
7544957Scaelawk job.
7644957Scael.Sh SEE ALSO
7744957Scael.Xr setitimer 2 ,
7844957Scael.Xr alarm 3 ,
7944957Scael.Xr sleep 3 ,
8044957Scael.Xr at 1
8144957Scael.Sh STANDARDS
8244957ScaelThe sleep function is expected to be POSIX 1003.2 compatible.
83