是否存在 runonce 命令来限制命令执行
Linux 下有这个命令吗?
runonce --dampen 300 echo "hello"
该命令将采用要运行的命令和限制其执行频率的可选标准。
选项 dampen 表示等待 300 毫秒,然后运行该命令。此命令的任何其他执行都会合并为一次运行。这允许您以通用方式折叠事件并组合它们的执行。
如果您
runonce --dampen 300 echo "hello"
runonce --dampen 300 echo "hello"
runonce --dampen 300 echo "hello"
几乎同时运行三个不同的子 shell,第一个子 shell 将存活 300 毫秒并打印 hello。另外两个人会立即返回,什么也不做。
如果存在,该工具的名称或其项目页面的链接是什么?
Does this command exist for Linux?
runonce --dampen 300 echo "hello"
The command would take a command to run and optional criteria to limit of frequently it is executed.
The option dampen says wait 300 milliseconds and then run the command. Any other executions of this command get coalesced into a single run. This allows you to collapse events in a generic way and combine their execution.
if you ran
runonce --dampen 300 echo "hello"
runonce --dampen 300 echo "hello"
runonce --dampen 300 echo "hello"
From three different sub-shells at roughly the same time, the first one would live for 300 milliseconds and print hello. The other two would return immediately and do nothing.
If this exists, what is the name of the tool or a link to it's project page?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
一个可能的解决方案(以某种方式取自
flock
手册页)是:用法示例:
其中 10 是秒数(不是毫秒)。
编辑:
在commad+parameters上引入了哈希
A possible solution, somehow taken from
flock
man page, would be:Example usage:
where 10 is a number of seconds (not milliseconds).
EDIT:
introduced hashing on commad+parameters
我想你可能想看看cron,看看这是否满足你的要求
I think you may want to look at cron, to see if this meets your requirement