我需要运行一个具有多个时间限制和不同限制信号的超时程序。
例如:
运行 nano,超时后 5 秒后发送 SIGTERM,10 秒后发送 SIGKILL
答案1
程序“sleep”是 coreutils 包的一部分。
只需在控制台中执行此命令:
man sleep
您将找到有关该程序的手册页。
NAME
sleep - delay for a specified amount of time
SYNOPSIS
sleep NUMBER[SUFFIX]...
sleep OPTION
DESCRIPTION
Pause for NUMBER seconds. SUFFIX may be 's' for seconds (the default), 'm' for minutes, 'h' for hours or 'd' for days. Unlike most implementations that require NUMBER be an integer, here
NUMBER may be an arbitrary floating point number. Given two or more arguments, pause for the amount of time specified by the sum of their values.
--help display this help and exit
--version
output version information and exit
AUTHOR
Written by Jim Meyering and Paul Eggert.