drupal – 脚本开始使用drush php-script在ctrl c后不会退出

发布时间:2022-04-30 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了drupal – 脚本开始使用drush php-script在ctrl c后不会退出脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在运行一个带有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脚本实际完成.
我怎么能停止脚本?

解决方法

Drush有没有功能参数,试试drush帮助?如果不…

验证运行的进程是否PHP进程:

killall -u yourusername PHP

或任何由drush运行的进程.

我认为这是在这种情况下你可以实现这一目标的唯一方法.

脚本宝典总结

以上是脚本宝典为你收集整理的drupal – 脚本开始使用drush php-script在ctrl c后不会退出全部内容,希望文章能够帮你解决drupal – 脚本开始使用drush php-script在ctrl c后不会退出所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。