Home > Backend Development > PHP Tutorial > cron定时5秒运行

cron定时5秒运行

WBOY
Release: 2016-06-06 20:49:15
Original
1267 people have browsed it

linux下定时最小为1分钟,怎么能按秒定时呢,求解

回复内容:

linux下定时最小为1分钟,怎么能按秒定时呢,求解

写个 daemon 程序,类似这样子:

<code>#!/bin/sh

while true; do
  do_work &
  sleep 5
done
</code>
Copy after login

或者有 systemd 的话,systemd.timer 是支持秒级精度的。

看下之前写的一个开源项目,可以满足你的需求

https://github.com/hfcorriez/croon

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template