Welcome to MLink Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
278 views
in Technique[技术] by (71.8m points)

php - Laravel 5.8 scheduler not running any tasks

Well I am trying to run my scheduler but it doesn't seem to do anything.

I have created this command

$schedule = new Schedule();
$schedule->command("hello:test_command 5")
    ->cron("13 12 * * *") //should run at 12:13, used as test time
    ->sendOutputTo("test_data.txt");

I tried running the scheduler both automatically and manually but there's nothing from the commands themself...

When I run scheduler:run this is what I get

Running scheduled command: "C:xampp_7phpphp.exe" "artisan" hello:test_command > "NUL" 2>&1

I am running it on windows 10 and PHP 7.3 if it matters at all.

Also, test_data.txt is not being created at all.

EDIT: Just to add up, after some testing, it seems that it's not even adding the command to the schedule...


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Do you schedule this command inside Kernel class? It can't be used outside this file. Also I think that you should pass parameter this way:

$schedule->command("hello:test_command --yourparam=5")

Instead of:

$schedule->command("hello:test_command 5")

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to MLink Developer Q&A Community for programmer and developer-Open, Learning and Share
...