shell 如何让某个命令在一秒钟执行20次

aljadyan 2013-10-10 11:28:39
shell 如何让某个命令在一秒钟执行20次
...全文
537 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
lm_whales 2013-10-11
  • 打赏
  • 举报
回复
The AT command schedules commands and programs to run on a computer at a specified time and date. The Schedule service must be running to use the AT command. AT [\\computername] [ [id] [/DELETE] | /DELETE [/YES]] AT [\\computername] time [/INTERACTIVE] [ /EVERY:date[,...] | /NEXT:date[,...]] "command" \\computername Specifies a remote computer. Commands are scheduled on the local computer if this parameter is omitted. id Is an identification number assigned to a scheduled command. /delete Cancels a scheduled command. If id is omitted, all the scheduled commands on the computer are canceled. /yes Used with cancel all jobs command when no further confirmation is desired. time Specifies the time when command is to run. /interactive Allows the job to interact with the desktop of the user who is logged on at the time the job runs. /every:date[,...] Runs the command on each specified day(s) of the week or month. If date is omitted, the current day of the month is assumed. /next:date[,...] Runs the specified command on the next occurrence of the day (for example, next Thursday). If date is omitted, the current day of the month is assumed. "command" Is the Windows NT command, or batch program to be run. Windows 的at 命令; at应该是unix 的命令;那么linux 应该也有。 Windows 的at 命令不过是抄袭一下,照猫画狗而已。
做或不做 2013-10-11
  • 打赏
  • 举报
回复
一般很少有指令执行20次 会超过1秒的 当然不排除特殊情况 那就只能用多线程方式同时执行 当不超过1秒 可以完成20次的时候 问题是 你要在这1秒内20次是平均执行的 还是只要在这1秒内执行完20次就结束就可以 取当前时间 time_start time_end While(time_end - time_start >=1秒 && count <= 20) { 取当前时间time_end; 计算执行一次的时间 if(一次时间是否小于 20分之1){ 执行一次 ; count++ } else{ 一次执行时间为 20分之1 的几倍 启动倍数线程 } } 这个可以实现的
lm_whales 2013-10-11
  • 打赏
  • 举报
回复
at 命令,可以定时执行一些命令吧。
ZG 2013-10-11
  • 打赏
  • 举报
回复
命令不能并发执行的话就只能一个接一个依次执行,可并发的话可以用多线程或者简单点,在命令后加个 &,让命令进入后台执行,迅速开启20个命令
xiaohuh421 2013-10-11
  • 打赏
  • 举报
回复
循环执行, 如果单个命令完成的时间过长, 那么可以用20个线程同时执行这个命令.
赵4老师 2013-10-11
  • 打赏
  • 举报
回复
for /L %%i in (1,1,20) do start 某个命令

69,369

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧