php - 运行 .php 文件的 Cron 作业失败
问题描述
我有一个问题。Raspberry Pi 与 Raspberry Pi OS Lite。我有一个位于 /var/www/html/bloomsky.php 的 .php 文件
这个 .php 文件只是要求每隔 1 分钟从 AmazonAWS 服务器下载一个新图像(以 1 分钟测试,但将来会达到 5 左右)当我访问该网站并将其直接指向Bloomsky 时.php 文件,然后 PHP 文件确实可以下载更新的图像并覆盖 /var/www./html/image.jpg 中存在的图像
当我检查 image.jpg 文件的时间戳时,它显示了bloomsky.php 文件伸出手并抓取一个新文件并覆盖它的当前时间。
所以 PHP 文件按预期工作。所以我创建了一个 cron 作业来定期运行该 bloomsky.php 文件。用于Crontab -e
创建条目 这里是整个文件
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').
#
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
#
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
# For more information see the manual pages of crontab(5) and cron(8)
#
# m h dom mon dow command
* * * * * root /usr/bin/php /var/www/html/bloomsky.php
我也试过
* * * * * root /var/www/html/bloomsky.php
保存这些更改后,我也重新启动了。
如果 Cron 作业每分钟都正常工作,它将启动Bloomsky.php
文件并下载并覆盖image.jpg
文件,从而更新其时间戳详细信息。
那没有发生。我还制作了该文件的副本Bloomsky.php
并将其放在我的主目录中。
解决方案
推荐阅读
- perl - 如何安装不在 CPAN 上的 Perl 模块?
- azure - 将 CreateTableIfNotExists 或 DoesTableExist 与 Azure 表存储一起使用是否有任何开销?
- laravel - Laravel Voyager symlink():没有这样的文件或目录 CPanel
- fortran - 如何使用千位分隔符和小数分隔符逗号将数字读入 fortran,例如 123.456.891.234,56
- r - R中的顺序无关字符串匹配
- css - 未应用 Bootstrap 4 CSS
- javascript - 数组中的嵌套对象 - 对象破坏 es6
- javascript - 使用 Javascript 将 UTM 参数传递给按钮 URL
- pine-script - 交易视图 - 高斯趋势线
- javascript - 我正在尝试找到一种方法来打印外部 URL 的正文。我已经可以正确打印标题