Script started with drush php- Script will not exit after ctrl + c

I am running a large PHP script with drush. The script takes a very long time to run - maybe a few hours, and I would like to stop it when I want. Here is an example php script I run:

$iter = 1; while( $iter <= 50 ){ echo "iteration no ". $iter ."\n"; $iter++; sleep( 1 ); } 

Here is the command with which I run it:

 $ drush php-script userstest.php 

When I press CTRL + C, the drush command stops, but the PHP script continues to work. Here's what it looks like:

 $ drush php-script userstest.php iteration no 1 iteration no 2 iteration no 3 $ iteration no 4 iteration no 5 iteration no 6 iteration no 7 ^C $ iteration no 8 iteration no 9 iteration no 10 iteration no 11 ^C $ iteration no 12 iteration no 13 iteration no 14 iteration no 15 

And it continues until the PHP script is executed. How can i stop the script?

+4
source share
1 answer

Drush doesn't have a function parameter for this, try drush help ? If not...

Check if the process that is running is a PHP process, and then:

 killall -u yourusername php 

or some process is running drush.

I think the only method you can achieve in this case.

+1
source

Source: https://habr.com/ru/post/1443669/


All Articles