使用 crontab 每分钟执行一次脚本,每 24 小时执行一次 [英] Using crontab to execute script every minute and another every 24 hours

查看:72
本文介绍了使用 crontab 每分钟执行一次脚本,每 24 小时执行一次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一个 crontab 语法,它应该每分钟执行一个特定的 PHP 脚本 /var/www/html/a.php.每分钟的执行必须从 00:00 开始.另一个任务必须在 00:00 /var/www/html/reset.php(每 24 小时一次)执行脚本.

I need a crontab syntax which should execute a specific PHP script /var/www/html/a.php every minute. The execution on every minute must start at 00:00. The other task which must execute a script at 00:00 /var/www/html/reset.php (once every 24 hours).

推荐答案

每分钟:

* * * * */path/to/php/var/www/html/a.php

每 24 小时(每个午夜):

every 24hours (every midnight):

0 0 * * */path/to/php/var/www/html/reset.php

请参阅此参考以了解 crontab 的工作原理:http://adminschoice.com/crontab-quick-reference,以及这个构建 cron jobx 的便捷工具:http://www.htmlbasix.com/crontab.shtml

See this reference for how crontab works: http://adminschoice.com/crontab-quick-reference, and this handy tool to build cron jobx: http://www.htmlbasix.com/crontab.shtml

这篇关于使用 crontab 每分钟执行一次脚本,每 24 小时执行一次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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