我正在用 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 脚本。我怎样才能停止脚本呢?