AIX sleep Command

本文详细解释了Linux中的sleep命令,用于暂停进程执行指定秒数,支持定时任务示例和退出状态码。还介绍了如何使用循环结构实现定期执行任务并能接收中断。
摘要由CSDN通过智能技术生成

Purpose

Suspends execution for an interval.

Syntax

sleep Seconds

Description

The sleep command suspends execution of a process for at least the interval specified by the Seconds parameter. The amount of time specified in the Seconds parameter can range from 1 to MAXINT (2,147,483,647) seconds.

Exit Status

This command returns the following exit values:

Item

Description

0The execution was successfully suspended for at least Seconds seconds, or a SIGALRM signal was received.
>0An error occurred.

Examples

  1. To run a command after a certain amount of time has passed, enter:
    (
    echo  "SYSTEM SHUTDOWN IN 10 MINUTES!" | wall
    sleep 300; echo "SYSTEM SHUTDOWN IN 5 MINUTES!" | wall
    sleep 240; echo "SYSTEM SHUTDOWN IN 1 MINUTE!" | wall
    sleep 60; shutdown
    )&
    This command sequence warns all users 10 minutes, 5 minutes, and 1 minute before the system is shut down.
  2. To run a command at regular intervals, enter:
    while true
    do
     date
     sleep 60
    done
    This shell procedure displays the date and time once a minute. To stop it, press the Interrupt key sequence.
  • 6
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值