1. #!/bin/sh
  2. ### find pid
  3. jps=`jps -m`
  4. echo "$jps"|while read i
  5. do
  6. if[[ $i =~"agentTestTopic"]];
  7. then
  8. #将字符串分割成数组
  9. OLD_IFS="$IFS"
  10. IFS=" "
  11. arr=($i)
  12. IFS="$OLD_IFS"
  13. echo ${arr[0]}
  14. pid=${arr[0]}
  15. kill -9 $pid
  16. fi
  17. done
  18. echo "agentTestTopic is stoped"

用shell通过jps -m来杀死进程的更多相关文章

  1. Linux Shell脚本实现根据进程名杀死进程

    Shell脚本源码如下: #!/bin/sh #根据进程名杀死进程 if [ $# -lt 1 ] then echo "缺少参数:procedure_name" exit 1 f ...

  2. linux根据进程名字杀死进程

    ps -ef | grep procedure_name | grep -v grep | awk '{print $2}' | xargs kill -9 Linux Shell脚本实现根据进程名杀 ...

  3. linux shell根据端口返回进程号杀死进程的方法

    linux shell根据端口返回进程号杀死进程的方法<pre>kill `lsof -t -i:9501`</pre>这个就是杀死9501端口的进程号

  4. shell脚本批量杀死进程

    使用Ubuntu系统时常会遇到机器卡死的情况(人生最大的痛苦),所有的键都没有用,只好强制关机,我似乎对此已经'乐此不疲了'. 看到又神牛说: 可以在tty里面把相关的进程杀死,之后就正常.(到目前我 ...

  5. Linux如何查看进程、杀死进程、启动进程等常用命令

    Linux如何查看进程.杀死进程.启动进程等常用命令 关键字: linux 查进程.杀进程.起进程1.查进程    ps命令查找与进程相关的PID号:    ps a 显示现行终端机下的所有程序,包括 ...

  6. Linux中查看进程及杀死进程命令

    Linux中想杀死fcitx进程,然后再重启它. root@www.linuxidc.com:/home/zhangbin# ps -e | grep 'fcitx' 3405 ?        00 ...

  7. Android基础【1】杀死进程(强行停止)应用程序的方法

    写在前面: 进入手机ODM已经很久,经历过几个项目项目下来,对高通.展讯.Marvell平台都进行了接触,对于我个人来说,参与手机系统项目的开发与维护,最明显的好处是可以深入的了解某一功能的具体实现过 ...

  8. linux kill杀死进程

    背景:这个命令总是记不住,在此稍作记录,方便查看! 1 杀死进程 1.1 查看进程 此时如果我想杀了火狐的进程就在终端输入: $ kill -s 9 1827 其中-s 9 制定了传递给进程的信号是9 ...

  9. linux 杀死进程kill 等用法

    kill -9 $(ps -ef | grep process_name | grep -v grep | awk  '{print $2}')   稍微解释一下:  awk  '{print $2} ...

随机推荐

  1. python列表(list)的使用技巧及高级操作

    python列表(list)的使用技巧及高级操作置顶 2018年03月25日 13:39:41 顽劣的石头 阅读数:5478 标签: python extend bisect list enumera ...

  2. idea本地安装 lombok插件

    转:https://blog.csdn.net/weixin_41404773/article/details/80689639 idea本地安装 lombok插件 项目中经常使用bean,entit ...

  3. Windows10下pip的配置文件设置

    pip.ini的内容: [global] index-url = http://mirrors.aliyun.com/pypi/simple trusted-host = mirrors.aliyun ...

  4. 2017常见的50道java基础面试题整理(附答案)

    1.作用域public,private,protected,以及不写时的区别 答: 区别如下: 2.Anonymous Inner Class (匿名内部类) 是否可以extends(继承)其它类,是 ...

  5. [LeetCode&Python] Problem 563. Binary Tree Tilt

    Given a binary tree, return the tilt of the whole tree. The tilt of a tree node is defined as the ab ...

  6. go:基于时间轮定时器方案

    /* * http://blog.csdn.net/yueguanghaidao/article/details/46290539 * 修改内容:为定时器增加类型和参数属性,修改回调函数类型 */ p ...

  7. jquery实现拖拽进度条并显示百分比的特效

    #box{position: relative; width: 200px; height: 50px; border: 1px solid #eee; margin: 50px auto 0;} # ...

  8. 杜教BM【转载】

    https://blog.csdn.net/qq_36876305/article/details/80275708 #include <bits/stdc++.h> using name ...

  9. 《DSP using MATLAB》Problem 5.9

    代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...

  10. python os模块使用笔记(更新)

    import os 添加os模块 walk方法: os.walk(path) path是string形式的目标目录 生成一个某目录下递归树形目录迭代器,方便递归访问子目录,访问目录就能够轻松访问子文件 ...