Cron:每隔1秒运行cron? [英] Cron: running cron every 1 second?

查看:203
本文介绍了Cron:每隔1秒运行cron?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何每隔1秒运行cron?

How can I run cron every 1 second? there's only minutes option by default

推荐答案

让cron第一次启动作业。将程序置于无限循环中,在每个循环结束时sleep()1秒。这样,在C:

Let cron start the job one time, the first time. Put the program in an infinite loop, sleep() for 1 second at the end of each loop. like this, in C:

  int main( int argc, char ** argv ) {
      while (1) {
        // do the work
        sleep(1000);
      }
  }

能工作吗?

这篇关于Cron:每隔1秒运行cron?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆