0

We have a command in symfony that is being exceuted via a minutely CRON. The command is creating, writing records from the database to the CSV file and then downloading CSV file. I need to know if a command is executed once and the CSV process has started then on the next execution of the cron after a minute will the previous execution stop or will continue in the background ?

1 Answer 1

1

They will run in parallel as you would have started it from the console, so if that is undesirable, you would want to make sure that the previous process has finished or make the cron jobs run on bigger interval (or both).

You can use in cron * * * * * /usr/bin/pgrep "console" > /dev/null || bin/console ... or something like that to check if there is an unfinished job already running

Sign up to request clarification or add additional context in comments.

3 Comments

thanks for your answer. I've found a method to lock a process, in my case the command that is going to be executed via CRON, so when the previous command execution hasn't finished the next CRON won't execute the script. Here's the link: stackoverflow.com/a/34412312/13345631
I also want to know does commands, running via PHP CLI get a timeout if the script is time taking ? It mentioned here in the doc that for PHP CLI the max_execution_time is set 0 by default but just want to confirm. php.net/manual/en/info.configuration.php#ini.max-execution-time
it does not have execution limit, will run forever. It has a memory_limit though, so if there is a memory leak in your code it will eventually stop unexpectedly. Locks are good solution but i just provided a simple solution that does not mess with the code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.