duanfazhun0383 2013-08-06 16:22
浏览 13

服务器端计划任务:需要安排频率为5秒的任务

I need to write a server-side program that lives on the server, and is checking a database consistently for new entries.

When a new entry shows up in the database, the program should process the data and put the results somewhere else.

It is important to hi-light that the process isn't instigated by new entries showing up, but by the program checking for new entries on its own.

Some people I've spoken to brought up cron jobs, I was curious what if this is the solution for me? I see that it has limitations, it won't run less than every minute. I was hoping for the program to run every 5 seconds, would I be better off writing a shell script or is that a bootleg fix?

  • 写回答

2条回答 默认 最新

  • duangang4940 2013-08-06 16:26
    关注

    I'm not sure if this is conventional (?) but...

    Use a database trigger on INSERT that runs an external program (PHP, Python, .. whatever). Which database are you using? I think this post is old but might be of help: http://crazytechthoughts.blogspot.co.uk/2011/12/call-external-program-from-mysql.html

    评论

报告相同问题?

悬赏问题

  • ¥15 java报错:使用mybatis plus查询一个只返回一条数据的sql,却报错返回了1000多条
  • ¥15 Python报错怎么解决
  • ¥15 simulink如何调用DLL文件
  • ¥15 关于用pyqt6的项目开发该怎么把前段后端和业务层分离
  • ¥30 线性代数的问题,我真的忘了线代的知识了
  • ¥15 有谁能够把华为matebook e 高通骁龙850刷成安卓系统,或者安装安卓系统
  • ¥188 需要修改一个工具,懂得汇编的人来。
  • ¥15 livecharts wpf piechart 属性
  • ¥20 数学建模,尽量用matlab回答,论文格式
  • ¥15 昨天挂载了一下u盘,然后拔了