每 10 分钟执行一次 php cron 作业 [英] php cron job every 10 minutes

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

问题描述

我正在尝试运行 cron 作业,以便在我的服务器上每 10 分钟运行一次 php 脚本.该脚本更新数据库.现在我的 crontab 看起来像:

I'm trying to run a cron job so that a php script will run every 10 minutes on my server. The script updates a database. Right now my crontab looks like:

* /10 * * * * /usr/bin/php  /home/user/public_html/domain.com/private/update.php

然而,php 脚本似乎永远不会运行.我还尝试在使用以下命令更新 cron 选项卡后重新加载 cron:

However, the php script never seems to run. I've also tried reloading cron after updating the cron tab with :

  $ /etc/init.d/cron reload

但这也不起作用.我当前的 crontab 看起来格式正确吗?是否需要为文件指定特定权限才能运行脚本?

but this didn't work either. Does my current crontab look correctly formatted? Are there specific permissions that need to be specified on a file in order for it to run a script?

推荐答案

*"和/10"之间不应有空格.应该是:

There should not be a space between "*" and "/10". It should be:

*/10 * * * * /usr/bin/php  /home/user/public_html/domain.com/private/update.php

这篇关于每 10 分钟执行一次 php cron 作业的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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