【问题标题】:Laravel: Scheduler not working when specific time is givenLaravel:给定特定时间时调度程序不起作用
【发布时间】:2019-01-10 08:36:41
【问题描述】:

尝试在 Larval 中调度命令:

$schedule->command('Cname')->everyFiveMinutes(); -- Works just fine

但是当我给出具体的日期和时间时 -

    $schedule->command('Cname')->weeklyOn(3,'9:10');
or 

    $schedule->command('Cname')->weekly()->thursdays()->at('09:10');

Its not working 

我做错了什么?有什么想法/建议吗?

【问题讨论】:

  • 它使用应用程序的时区,默认设置为 UTC。这是我的第一个假设。
  • 不错的假设没有考虑让我试试
  • 您能显示系统的 cron-tab 中的内容吗?
  • 请运行命令crontab -l并发布结果。

标签: laravel laravel-scheduler


【解决方案1】:

我相信你可以只使用 cron 表达式 * * * * * *

$schedule->command('Command Name')->cron('10 9 * * 4');

每周四 09:10 前执行

解释

 * * * * *  command to execute
 ┬ ┬ ┬ ┬ ┬
 │ │ │ │ │
 │ │ │ │ │
 │ │ │ │ └───── day of week (0 - 7) (0 to 6 are Sunday to Saturday, or use names; 7 is Sunday, the same as 0)
 │ │ │ └────────── month (1 - 12)
 │ │ └─────────────── day of month (1 - 31)
 │ └──────────────────── hour (0 - 23)
 └───────────────────────── min (0 - 59)

【讨论】:

  • 好的,我试试
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2018-12-26
  • 2016-05-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-08-24
相关资源
最近更新 更多