Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

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

symfony - Create a command in Symfony5 that executes several times from an hour

I would like to know how to create a command in Symfony 5 that executes several times from an hour. I give you an example:

  1. Create a command that we will call with the option
app:schedule-command

https://symfony.com/doc/current/console.html

  1. The content of the command will be only this:
echo "Hello world";
  1. This command will be executed every 5 minutes, every day from 11:00pm to 11:30pm.

NOTE: This is not valid for me:

https://symfony.com/doc/current/cloud/cookbooks/crons.html

(use Symfony Cloud, and i want to test in local)

Thank you very much for your help.

question from:https://stackoverflow.com/questions/66062877/create-a-command-in-symfony5-that-executes-several-times-from-an-hour

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

1 Answer

0 votes
by (71.8m points)

You need to use this cron: 0-30/5 23 * * * bin/console app:schedule-command

For testing locally, if you are under linux or macOS, CRON are working as well. If you are under windows, you can use the Windows Task Scheduler.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...