Domanda

I'm running a big php script with drush. The script takes really long time to run - probably few hours, and I would like to stop it whenever I want. Here is an example php script I'm running:

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

Here is the command I'm running it with:

$ drush php-script userstest.php

When I press CTRL+C, the drush command stops, but the php script continues to run. Here is how it looks:

$ 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 goes on until the php script it actually done. How can I stop the script as well?

È stato utile?

Soluzione

Has Drush have no parameter of function for that, try drush help? If not...

Verify if the process that is run is a PHP process then:

killall -u yourusername php

or whatever process is run by drush.

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top