Pkill -f不适用于进程终止 [英] Pkill -f doesn't work for process killing

查看:66
本文介绍了Pkill -f不适用于进程终止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行以下过程:

342 pts/2    T    0:00 sh -c sudo screen /usr/bin/python /usr/bin/btdownloadcurses "http://zoink.it/torrent/732A4A9B54B7E3A916C2835D936D985942F65A6D.torrent" --display_interval 20 --saveas "/srv/"
343 pts/2    T    0:00 sudo screen /usr/bin/python /usr/bin/btdownloadcurses http://zoink.it/torrent/732A4A9B54B7E3A916C2835D936D985942F65A6D.torrent --display_interval 20 --saveas /srv/
344 pts/2    T    0:00 screen /usr/bin/python /usr/bin/btdownloadcurses http://zoink.it/torrent/732A4A9B54B7E3A916C2835D936D985942F65A6D.torrent --display_interval 20 --saveas /srv/

我尝试运行:

pkill -f http://zoink.it/torrent/732A4A9B54B7E3A916C2835D936D985942F65A6D.torrent

但是该进程仍在运行.
如何强制杀死包含以下内容的进程:""> http://zoink.it/torrent/732A4A9B54B7E3AtorrentC2835D936D985942F65A6D/a>?

But the process still running.
How do I force kill the processes that contain: "http://zoink.it/torrent/732A4A9B54B7E3A916C2835D936D985942F65A6D.torrent" ?

问题如下:

ps ax | grep 'Momomoko.E01.140011.HDTV.H264.720p.mp4'

我想杀死包含上述字符串的所有进程.

I want to kill all process that contain the above string.

我尝试运行上面的行,它返回三个结果:

I tried running the above line, and it returns three results:

  342 pts/2    T    0:00 sh -c sudo screen /usr/bin/python /usr/bin/btdownloadcurses "http://zoink.it/torrent/732A4A9B54B7E3A916C2835D936D985942F65A6D.torrent" --display_interval 20 --saveas "/srv/Momomoko.E01.140011.HDTV.H264.720p.mp4"
  343 pts/2    T    0:00 sudo screen /usr/bin/python /usr/bin/btdownloadcurses http://zoink.it/torrent/732A4A9B54B7E3A916C2835D936D985942F65A6D.torrent --display_interval 20 --saveas /srv/Momomoko.E01.140011.HDTV.H264.720p.mp4
  344 pts/2    T    0:00 screen /usr/bin/python /usr/bin/btdownloadcurses http://zoink.it/torrent/732A4A9B54B7E3A916C2835D936D985942F65A6D.torrent --display_interval 20 --saveas /srv/Momomoko.E01.140011.HDTV.H264.720p.mp4

我如何运行此行:

ps ax | grep 'Momomoko.E01.140011.HDTV.H264.720p.mp4'

.. with php和 kill -9 所有匹配的过程?

..with php, and kill -9 all the matching processes?

推荐答案

尝试使用 kill 命令代替

kill -9 <pid>

它肯定会工作,因为我自己尝试过并且非常方便.

It will work for sure, cause I have tried it myself and very handy all times.

在脚本文件中使用以下命令,然后使用 kill 命令进行循环运行,

Use the following in a script file then run for loop with kill command,

ps|grep torrent|cut -f1 -d' '

像下面这样的for循环,作为我系统中的确切工作副本;

like this for loop as shown below, as exact working copy from my system;

for p in `ps|grep torrent|cut -f1 -d' '`; do
   kill -9 $p
done

我希望这会最终对您有所帮助.

I hope this will help you finally.

根据您要使用PHP运行此问题的最新编辑问题,可以通过 exec 命令实施该问题,请遵循问题寻求解决方案.

As per latest edited question you want to run this with PHP, it can be implemented through exec command, please follow the question for solution.

这篇关于Pkill -f不适用于进程终止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆