4
我正在運行一個帶有drush的大php腳本。該腳本需要很長時間才能運行 - 可能需要幾個小時,並且我希望在需要時停止它。 下面是一個例子PHP腳本我運行:以ctrl + c結尾的以腳本開頭的dr腳本不會退出
$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腳本,它實際上完成。 我怎樣才能停止腳本?
這實際上工作!非常感謝! 唯一的是我在Windows 7上運行Cygwin下的Drush。進程列表中沒有列出任何php進程(在Cygwin下使用ps aux),killall在那裏不起作用。所以我不得不在cmd中使用taskkill/F/IM php.exe – jetpackpony