标签: pkill

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/
Run Code Online (Sandbox Code Playgroud)

我试着跑:

pkill -f http://zoink.it/torrent/732A4A9B54B7E3A916C2835D936D985942F65A6D.torrent
Run Code Online (Sandbox Code Playgroud)

但这个过程仍在运行.
如何强制终止包含以下内容的进程:" http://zoink.it/torrent/732A4A9B54B7E3A916C2835D936D985942F65A6D.torrent "?


编辑如下:

ps ax | grep 'Momomoko.E01.140011.HDTV.H264.720p.mp4'
Run Code Online (Sandbox Code Playgroud)

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

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

  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 …
Run Code Online (Sandbox Code Playgroud)

php linux termination kill-process pkill

12
推荐指数
2
解决办法
2万
查看次数

运行react-scripts后如何停止?

我用npm start来启动一个React应用程序,其中package.json中定义了start:

{
  "name": "testreactapp",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "react": "^15.6.1",
    "react-dom": "^15.6.1",
    "react-scripts": "1.0.10"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject"
  }
}
Run Code Online (Sandbox Code Playgroud)

我现在想停止它,而不关闭终端。我怎么做?

尝试过:npm stop testrectapp,但是会抛出错误,需要脚本

然后尝试:使用脚本“ stop”运行npm run stop:“ pkill --signal SIGINT testreactapp”抛出错误“ pkill无法识别为命令”

编辑:在bash中运行ps显示: PID PPID PGID WINPID TTY UID STIME COMMAND 6652 1 6652 6652 ? 197612 19:52:49 /usr/bin/mintty 1092 1 1092 1092 ? 197612 Jul 25 /usr/bin/mintty 11092 6652 11092 10060 pty1 197612 …

javascript node.js reactjs pkill react-scripts

7
推荐指数
5
解决办法
2万
查看次数

在linux bash中杀死一个进程子树

我正在键入一个小的bash脚本,它应该克隆一个git存储库,签出一个特定的硬编码分支并监听一些新的提交.如果发现新的提交,脚本应该杀死正在运行的'MyApp'实例,执行git pull并最终使用gradle构建它.它也应该再次通过gradle开始.

是的,它是一个带有gradle构建文件的java应用程序.

这是我的代码:

##!/bin/bash

# GitHub Repository and Paths
GLOBAL_REPOSITORY="..."
LOCAL_REPOSITORY="..."

# Go to the repository
cd $LOCAL_REPOSITORY

# Clone the git repository if not already done
if [ ! -d "$LOCAL_REPOSITORY/.git" ]
then
  git clone $GLOBAL_REPOSITORY $LOCAL_REPOSITORY
  git checkout dev
fi

# Pull and build if there are new commits
LAST_GLOBAL_COMMIT=""
LAST_LOCAL_COMMIT=""

CHILDS_PID=""

while true; do
  git fetch origin

  LAST_GLOBAL_COMMIT="$(git rev-parse origin/dev)"
  LAST_LOCAL_COMMIT="$(git rev-parse dev)"

  if [ "$LAST_GLOBAL_COMMIT" != "$LAST_LOCAL_COMMIT" ]
  then
    if [ "$CHILDS_PID != "" ] …
Run Code Online (Sandbox Code Playgroud)

linux bash kill process pkill

6
推荐指数
0
解决办法
100
查看次数

pkill通过远程ssh返回255和另一个命令的组合

当我尝试在远程主机上结合另一个命令执行pkill时,即使两个命令都成功,它也始终返回255。

例子

  1. ssh <remoteHost> 'pkill -f xyz' # returns 0 (rightly so when xyz is a process)
    
    Run Code Online (Sandbox Code Playgroud)
  2. ssh <remoteHost> 'source /etc/profile' # returns 0 (rightly so)
    
    Run Code Online (Sandbox Code Playgroud)

但是当我运行组合命令时:

  1. ssh <remoteHost> 'source /etc/profile; pkill -f xyz' # returns 255 - why?
    
    Run Code Online (Sandbox Code Playgroud)

关于“ pkill”与另一条命令的结合是有一些问题的,因为即使结合使用,以下内容也会返回零:

  1. ssh <remoteHost> 'source /etc/profile; ls' # returns 0
    
    Run Code Online (Sandbox Code Playgroud)

假设xyz当我们试图杀死它时,它始终在运行。

我不了解这种行为。为什么在情况3中返回255?

linux ssh pkill

3
推荐指数
1
解决办法
943
查看次数