drupal – 脚本开始使用drush php-script在ctrl c后不会退出
发布时间:2020-12-13 22:45:54 所属栏目:PHP教程 来源:网络整理
导读:我正在运行一个带有drush的大 PHP脚本.该脚本需要很长时间才能运行 – 可能需要几个小时,我想随时随地停止它. 这是我正在运行的示例php脚本: $iter = 1;while( $iter = 50 ){ echo "iteration no ". $iter ."n"; $iter++; sleep( 1 );} 这是我运行它的命令
我正在运行一个带有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运行的进程. 我认为这是在这种情况下你可以实现这一目标的唯一方法. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |