drupal - 使用 drush php-script 启动的脚本在 ctrl+c 后不会退出

标签 drupal drush

我正在用 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 help ?如果不...

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

killall -u yourusername php

或任何由 drush 运行的进程。

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

关于drupal - 使用 drush php-script 启动的脚本在 ctrl+c 后不会退出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13196981/

相关文章:

php - Drupal 错误地转义了 javascript 中的标签

drupal 隐藏非管理员用户的帐户电子邮件和密码更改

php - 安装 Drupal 7 时的数据库配置

PHP fatal error : Undefined class content drush

linux - 直接从 GitLab 私有(private)仓库打开文件

regex - htaccess 重定向多语言 Drupal 站点的一个域

drupal - 如何设置/删除元标记?

php - 为什么将 docker-compose exec 的输出管道输出到 grep,会破坏它?

php - 如何在没有 Drupal 容器的情况下安装 Drush

linux - GoDaddy cpanel 安装 : Trying to install Drush for Drupal and possibly can't find php-cli?