【问题标题】:Using Sleep command in Crontab CentOS在 Crontab CentOS 中使用 Sleep 命令
【发布时间】:2023-03-31 05:00:01
【问题描述】:

我正在尝试结合来自 Crontab 的 Sleep 命令执行 php 脚本。以下是相关代码:

SHELL=/bin/bash 
PATH=/sbin:/bin:/usr/sbin:/usr/bin 
MAILTO=root HOME=/  
# run-parts 

* * * * * sleep 5 && root /usr/bin/php /path/to/the/php/file.php

但它根本不会执行。有什么提示吗?

【问题讨论】:

  • @inquisitor 抱歉,这是我帖子中的一个类型,它是小写但仍然没有
  • 执行作业,然后cat /var/log/syslog 看看它失败的原因。
  • @fedorqui 每秒? * * * * * 表示 1 分钟。 (我很确定)

标签: php linux cron centos crontab


【解决方案1】:

sleep 5 && root /usr.. 中删除root

如果你想以root身份运行,正确的格式是:

* * * * * root sleep 5 && /usr/bin/php /path/to/the/php/file.php

【讨论】:

    猜你喜欢
    • 2015-07-25
    • 2016-12-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-10-11
    • 2017-01-03
    相关资源
    最近更新 更多