简体   繁体   English

Cron作业要运行24小时的php脚本,然后将其停止

[英]Cron job to run a php script for 24 hours then stop it

Is it possible with cron tab(job) to run .php script every sunday at 0:01h till 23:59h? cron tab(job)是否可以在每个星期日的0:01h到23:59h运行.php脚本? The main idea is at Sunday 0:01h to run this script which will place some text on the websait. 主要想法是在周日0:01h运行此脚本,该脚本将在Websait上放置一些文本。 This text will stay there for 24 hours and at 23:59h to stop the script and hide the text? 该文本将在此处停留24小时,并在23:59h停止脚本并隐藏文本? Any ideas how can do this? 任何想法如何做到这一点?

1 0 * * 0     /usr/bin/php myScriptThatCreatesContent.php
59 23 * * 0   /usr/bin/php myScriptThatRemovesContent.php

See Cron format reference here , taking into account that most implementations only use 5 fields (year not supported). 考虑到大多数实现仅使用5个字段(不支持年份), 请参阅此处的Cron格式参考

The formats above specify minutes and hour and day-of-week, which can occur on any day of month in any month (the 2 stars). 上面的格式指定分钟,小时和星期几,它们可以在任何月份的任何一天(两颗星)出现。 The 0 at the end is the first day of the week, which is Sunday for crons. 末尾的0是一周的​​第一天,也就是星期天。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM