A
A
Alexander2014-05-25 09:56:16
PHP
Alexander, 2014-05-25 09:56:16

Another question about cron and php exec?

I'll try to describe it like this:
there is a crontask.php

// читаю данные из базы и при соблюдении условия вытаскиваю одно значение
// это значение $command является командой для исполнения 
// ставлю статус команды - 1 - исполняется, заношу эту 1 в БД
  exec($command);
// далее я меняю статус этой команды в БД на 2

I run this script in the cron - it starts, but does not execute the command, but immediately changes the status to 2, supposedly completed.
what is missing?
everything is read from the database correctly, the cron script sees it.
when you open this script through the browser - everything is done as it should. Something is wrong with cron.

Answer the question

In order to leave comments, you need to log in

5 answer(s)
A
Alexander, 2014-05-27
@ghost1k

there were problems with the rights of the user from which the cron was launched, there were not enough rights to write.

S
Sergey, 2014-05-25
Protko @Fesor

I understand you want to make a task queue based on cron? Maybe you should look towards RabbitMQ/ActiveMQ?

M
Melkij, 2014-05-25
@melkij

For example, the working directory is different.

V
Valentine, 2014-05-25
@vvpoloskin

1) Log into the console as root
2) Go to the folder /
3) Run php <script-name>
After that, look for errors

C
cmx, 2014-05-27
@cmx

SELinux installed?
If yes, then try
If after that everything worked, then either disable the SE service, or google in the direction of its administration.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question