Y
Y
Yariy2022-03-05 08:10:15
PHP
Yariy, 2022-03-05 08:10:15

How to run symfony commands from cron?

There is a website, the main core is Bitrix. Now we are adding services to it, incl. screwed Project\Console\Application from symfony.

The run file contains the script to run the command. When running the command from the site directory
php run kafka:master-products:from-bus-to-queue
The command is executed kafka:master-products:from-bus-to-queue
But if the command is run from the server root

php /home/bitrix/ext_www/standName/run kafka:master-products:from-bus-to-queue

An error occurs
There are no commands defined in the "kafka" namespace.

In the crown, accordingly, you need to write a command relative to the server root - the same error will occur during operation. Hence the question - how to make this monster work?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yariy, 2022-03-05
@Yariy

I solved the problem with a spike - before calling run, I write cd /required directory/ in the cron

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question