gpt4 book ai didi

linux - Crontab 未将脚本运行到 php 中

转载 作者:太空宇宙 更新时间:2023-11-04 03:36:13 24 4
gpt4 key购买 nike

我正在尝试运行一些 crontab 任务,但并非所有任务都被执行。这是我的 crontab -e

的确切内容
@hourly /root/scripts/update.sh
@hourly /root/scripts/twitter/update.sh

第一个任务有效,第二个任务无效。两者都有chmod 777

两者之间唯一的区别是后者的 .sh 中有这样的内容:

 #! /bin/bash
php -f updateTwitter.php

所以我想知道 crontab 调用脚本然后调用 .php 文件是否存在问题?

如果我手动运行脚本(./update.sh),它就可以工作。我检查了 crontab 日志,可以看到正在执行的进程。

我运行的是 CentOS6。

最佳答案

定时任务

MAILTO:you@example.com
@hourly cd /root/scripts/twitter; update.sh

在 update.sh

#!/bin/bash
/usr/bin/php updateTwitter.php

假设 updateTwitter.php 位于/root/scripts/twitter

关于linux - Crontab 未将脚本运行到 php 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31496865/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com