php - Laravel 调度:钩子后没有被调用
问题描述
我的 laravel (5.8) 应用程序位于文件夹中的共享主机上app
。绑定到域的文件夹public_html
位于app
. 我有一个这样的计划任务:
$schedule->command('feed:gen sitemap')
->withoutOverlapping()
->runInBackground()
->dailyAt('03:00')
->after(function() use($schedule) {
$schedule->exec('mv ~/app/public/Sitemap.xml ~/public_html/Sitemap.xml');
});
创建 sitemap.xml 并将其移动到网站根文件夹。该command
部分工作正常,sitemap.xml 在~/app/
文件夹中创建,但after()
不会调用钩子。我很确定mv
命令的路径很好。另一方面,文档中不清楚如何链接多个调用,包括钩子,以及哪些函数调用可以相互链接。也许我需要将其他东西链接到$schedule->exec()
...
PS:feed:gen sitemap
命令注册在routes/console.php
like
Artisan::command('feed:gen {type}', function (FeedGenerator $gen, $type) {
// some code
})->describe('Generates feeds for site');
解决方案
推荐阅读
- c# - 如何比较两个字符串列表列表
- spring-kafka - 使用 Spring Kafka 加密和解密消息
- python - 从 zsh 执行时,Automator 在 python 脚本中找不到包导入
- javascript - 如何使用 REST API 数据与 moment isBetween 更新打开/关闭时间
- django - 如何从 django 中的用户配置文件中删除数据
- pygame - pygame中的collidepoint函数是如何工作的?
- javascript - dom加载前的浏览器检查页面
- angular - Angular 上使用 rxjs 的嵌套 API 请求
- flutter - Flutter 崩溃并给出奇怪的信息
- python - 我究竟做错了什么?我的代码告诉我猜测不正确,当它正确时