aboutsummaryrefslogtreecommitdiff
path: root/ja_JP.eucJP/man/man1/sleep.1
blob: 47d0a20f46f088e88bcf583b36c4f513af140d2a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
.\" Copyright (c) 1990, 1993, 1994
.\"	The Regents of the University of California.  All rights reserved.
.\"
.\" This code is derived from software contributed to Berkeley by
.\" the Institute of Electrical and Electronics Engineers, Inc.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\" 4. Neither the name of the University nor the names of its contributors
.\"    may be used to endorse or promote products derived from this software
.\"    without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\"	@(#)sleep.1	8.3 (Berkeley) 4/18/94
.\" %FreeBSD: src/bin/sleep/sleep.1,v 1.20 2004/04/06 20:06:53 markm Exp %
.\"
.\" $FreeBSD$
.\"
.Dd April 18, 1994
.Dt SLEEP 1
.Os
.Sh 名称
.Nm sleep
.Nd 一定の時間実行を停止する
.Sh 書式
.Nm
.Ar seconds
.Sh 解説
.Nm
コマンドは、少なくとも
.Ar seconds
で指定した秒数だけ実行を停止します。
.Pp
.Nm
コマンドがシグナルを受信すると標準の動作を行います。
.Sh 実装に関する注
この実装においては、
.Dv SIGALRM
シグナルは特別には扱われません。
.Pp
.Nm
コマンドは、非整数の数値で指定された秒数を受け付けて、これを尊重します。
(小数点として
.Ql .\&
文字を使用します)。
.Bf Sy
これはポータブルではない拡張です。
これを使用するシェルスクリプトは、
他のシステムで正しく実行できないことを、ほぼ保証できます。
.Ef
.Sh 使用例
.Xr ( csh 1 
で)
あるコマンドの実行を
.Va x
秒後に設定したい場合:
.Pp
.Dl (sleep 1800; sh command_file >& errors)&
.Pp
上記の例では、command_file で指定したスクリプトを実行する前に
30 分間待ちます(
.Xr at 1
ユーティリティの項を参照)。
.Pp
あるコマンドを(
.Xr csh 1
を使って)繰り返し実行したい場合:
.Pp
.Bd -literal -offset indent -compact
while (1)
	if (! -r zzz.rawdata) then
		sleep 300
	else
		foreach i (`ls *.rawdata`)
			sleep 70
			awk -f collapse_data $i >> results
		end
		break
	endif
end
.Ed
.Pp
このようなスクリプトが必要とされるのは以下のような場合でしょう:
現在実行中のプログラムが、一連のファイル群を処理するのに予想以上の
時間を必要としていて、このプログラムが処理結果をファイル
(zzz.rawdata)に出力したらすぐに別のプログラムを起動して
そのファイルを処理したほうがよい場合があります。
上記のスクリプトでは、zzz.rawdata が生成されたかどうかを
5 分おきに確認し、生成が確認されたら 70 秒待って awk ジョブを
実行する、という操作を繰り返します。
.Sh 診断
.Ex -std
.Sh 関連項目
.Xr nanosleep 2 ,
.Xr sleep 3
.Sh 規格
.Nm
コマンドは、おそらく
.St -p1003.2
互換です。
.Sh 歴史
.Nm
コマンドは
.At v4
に登場しました。