4

我正在用 drush 运行一个大的 php 脚本。该脚本需要很长时间才能运行 - 可能需要几个小时,我想随时停止它。这是我正在运行的示例 php 脚本:

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

这是我运行它的命令:

$ drush php-script userstest.php

当我按 CTRL+C 时,drush 命令停止,但 php 脚本继续运行。这是它的外观:

$ 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

它一直持续到它实际完成的 php 脚本。我怎样才能停止脚本呢?

4

1 回答 1

1

Drush是否没有功能参数,试试drush help?如果不...

验证运行的进程是否是 PHP 进程,然后:

killall -u yourusername php

或由 drush 运行的任何进程。

我认为这是在这种情况下您可以实现的唯一方法。

于 2012-11-02T14:47:01.220 回答