Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2318815
  • 博文数量: 473
  • 博客积分: 12252
  • 博客等级: 上将
  • 技术积分: 4307
  • 用 户 组: 普通用户
  • 注册时间: 2007-10-12 10:02
文章分类

全部博文(473)

文章存档

2012年(8)

2011年(63)

2010年(73)

2009年(231)

2008年(98)

分类: LINUX

2011-04-30 11:13:52

sleep

This is the shell equivalent of a wait loop. It pauses for a specified number of seconds, doing nothing. It can be useful for timing or in processes running in the background, checking for a specific event every so often (polling), as in .

sleep 3 # Pauses 3 seconds.

Note

The sleep command defaults to seconds, but minute, hours, or days may also be specified.

sleep 3 h # Pauses 3 hours!

Note

The command may be a better choice than sleep for running commands at timed intervals.

usleep

Microsleep (the "u" may be read as the Greek "mu", or micro- prefix). This is the same as sleep, above, but "sleeps" in microsecond intervals. It can be used for fine-grain timing, or for polling an ongoing process at very frequent intervals.

usleep 30 # Pauses 30 microseconds.

This command is part of the Red Hat initscripts / rc-scripts package.

Caution

The usleep command does not provide particularly accurate timing, and is therefore unsuitable for critical timing loops.

阅读(2876) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~