另一个:- Cronjob 不工作

发布于 2024-12-09 14:35:17 字数 371 浏览 0 评论 0原文

我有一个 cronjob,它与其他有效的 cronjob 完全相同。但是,对于某些人来说,我从中看不到任何东西:-

* * * * * /usr/bin/php -f /var/www/vhosts/process/sync.php > /var/www/vhosts/process/logs/synclog.log 2>&1

我想跑步每一分钟、每一天、永远。但是,该脚本不会被执行。我知道这一点,因为我可以从 CLi 运行它并且它可以工作,并且可以输出文件。

命令有问题吗?如果没有,有没有办法监视此命令以便我可以看到问题?

我还检查了权限,它们与其他有效的文件相同。

非常感谢您的帮助。

I have a cronjob, which is ni-on identical to other cronjobs that do work. But, for some I see nothing from this:-

* * * * * /usr/bin/php -f /var/www/vhosts/process/sync.php > /var/www/vhosts/process/logs/synclog.log 2>&1

I want to run every minute, of every day, forever. However, this script isn't be actioned. I know this as I can run it from CLi and it works, as well as outputting a file.

Is there something wrong in the command? If not, is there a way to monitor this command so I can see the issues?

I've also checked the permissions, and they're identical to the other files that do work.

Many thanks for any help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

夜声 2024-12-16 14:35:17

一些 Linux 服务器使用不同的语法。要每分钟运行一个作业,有 3 种方法。

* * * * * /usr/bin/php -f /var/www/vhosts/process/sync.php > /var/www/vhosts/process/logs/synclog.log 2>&1
*/1 * * * * /usr/bin/php -f /var/www/vhosts/process/sync.php > /var/www/vhosts/process/logs/synclog.log 2>&1
1 * * * * /usr/bin/php -f /var/www/vhosts/process/sync.php > /var/www/vhosts/process/logs/synclog.log 2>&1

根据服务器和设置,其中之一应该可以工作。既然您已经说过第一个不会,请尝试其他两个中的一个。我知道我的托管服务器,我无法使用 */1。

some linux servers use different syntax. To run a job every minute there is 3 ways.

* * * * * /usr/bin/php -f /var/www/vhosts/process/sync.php > /var/www/vhosts/process/logs/synclog.log 2>&1
*/1 * * * * /usr/bin/php -f /var/www/vhosts/process/sync.php > /var/www/vhosts/process/logs/synclog.log 2>&1
1 * * * * /usr/bin/php -f /var/www/vhosts/process/sync.php > /var/www/vhosts/process/logs/synclog.log 2>&1

Depending on server and setup one of these should work. Since you already stated the first does not, try one of the other two. I know my hosting server, I cannot use */1.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文