定时任务不工作
我有一个奇怪的问题。我设置了一个 cron 来检查数据库中输入的给定日期。如果今天的日期与数据库记录匹配,则应该更改数据库表中的值。
现在,出于某种原因,如果将 cron 设置为每分钟运行一次,它就会像魅力一样发挥作用。如果设置为某个时间,则根本不会触发。 (MYDOMAIN 设置为正确的域。)
适用于: * * * * * php -q /var/www/vhosts/MYDOMAIN.com/httpdocs/admin/scripts/includes/check_date.php
不适用于: 40 16 * * * php -q /var/www/vhosts/MYDOMAIN.com/httpdocs/admin/scripts/includes/check_date.php
或该时间的任何变体
知道为什么它不会每分钟触发其他任何东西吗?
I have a strange problem. I have a cron set up to check a database for a given date that is entered. If today's date matches the db recond, it supposed to change a value in a db table.
now, for some reason if the cron is set to go off every minute, it works like a charm. If it's set to a certain time, it doesn't fire at all.
(MYDOMAIN is set to the proper domain. )
works with:
* * * * * php -q /var/www/vhosts/MYDOMAIN.com/httpdocs/admin/scripts/includes/check_date.php
doesn't work with:
40 16 * * * php -q /var/www/vhosts/MYDOMAIN.com/httpdocs/admin/scripts/includes/check_date.php
or any variation of that time
any idea why it wont fire on anything else then every minute?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
检查您的系统时间是否与您期望它触发的时区相匹配,方法是运行
Check that your system time matches the timezone you are expect it to fire in by running
您尝试过
59 23 * * *
吗?尝试一天的最后一分钟。也许这个脚本只在当天晚些时候起作用......Did you try
59 23 * * *
? try the last minute of the day. Maybe the script only works late in the day ...