• 大量陈旧进程的批量杀死


    [root@hadoop2 ~]# date
    Sat Dec 9 15:46:30 CST 2017
    [root@hadoop2 ~]# xlpy
    Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.8/FAQ
    root 572 0.0 0.0 106108 1012 ? Ss Dec08 0:00 /bin/sh -c python /home/data/crontab_chk_url/personas/trunk/plugins/spider/chk_url_status.py &> /dev/null;
    root 573 0.0 0.0 324144 2748 ? Sl Dec08 0:01 python /home/data/crontab_chk_url/personas/trunk/plugins/spider/chk_url_status.py
    root 684 0.0 0.0 106108 1012 ? Ss Dec08 0:00 /bin/sh -c python /home/data/crontab_chk_url/personas/trunk/plugins/spider/chk_url_status.py &> /dev/null;
    root 685 0.0 0.0 324408 2628 ? Sl Dec08 0:01 python /home/data/crontab_chk_url/personas/trunk/plugins/spider/chk_url_status.py
    root 773 0.0 0.0 106108 1012 ? Ss 07:37 0:00 /bin/sh -c python /home/data/crontab_chk_url/personas/trunk/plugins/spider/cron_chk_url_status_ordertab_notexpire.py &> /dev/null;
    root 774 0.0 0.0 241844 4640 ? S 07:37 0:00 python /home/data/crontab_chk_url/personas/trunk/plugins/spider/cron_chk_url_status_ordertab_notexpire.py
    root 1133 0.0 0.1 666024 14896 ? Sl 07:37 0:07 python /home/data/crontab_chk_url/personas/trunk/plugins/spider/cron_chk_url_status_ordertab_notexpire.py
    root 1288 0.0 0.0 106108 1012 ? Ss 10:30 0:00 /bin/sh -c python /home/data/crontab_chk_url/personas/trunk/plugins/spider/chk_url_status_30min.py &> /dev/null;
    root 1290 0.0 0.0 319840 5936 ? Sl 10:30 0:01 python /home/data/crontab_chk_url/personas/trunk/plugins/spider/chk_url_status_30min.py
    root 1414 0.0 0.0 106108 1012 ? Ss Dec08 0:00 /bin/sh -c python /home/data/crontab_chk_url/personas/trunk/plugins/spider/chk_url_status.py &> /dev/null;
    root 1417 0.0 0.0 319748 2744 ? Sl Dec08 0:01 python /home/data/crontab_chk_url/personas/trunk/plugins/spider/chk_url_status.py
    root 1559 0.0 0.0 106108 1012 ? Ss 11:07 0:00 /bin/sh -c python /home/data/crontab_chk_url/personas/trunk/plugins/spider/chk_url_status.py &> /dev/null;
    root 1560 0.0 0.1 324368 15676 ? Sl 11:07 0:01 python /home/data/crontab_chk_url/personas/trunk/plugins/spider/chk_url_status.py
    root 2049 0.0 0.0 106108 1012 ? Ss Dec08 0:00 /bin/sh -c python /home/data/crontab_chk_url/personas/trunk/plugins/spider/cron_chk_url_status_ordertab_notexpire.py &> /dev/null;
    root 2050 0.0 0.0 513552 2840 ? Sl Dec08 0:06 python /home/data/crontab_chk_url/personas/trunk/plugins/spider/cron_chk_url_status_ordertab_notexpire.py
    root 2173 0.0 0.0 106108 1152 ? Ss 14:37 0:00 /bin/sh -c python /home/data/crontab_chk_url/personas/trunk/plugins/spider/chk_url_status_30min.py &> /dev/null;
    root 2176 0.0 0.4 243996 37516 ? S 14:37 0:01 python /home/data/crontab_chk_url/personas/trunk/plugins/spider/chk_url_status_30min.py
    root 2341 0.0 0.4 320104 38400 ? Sl 14:37 0:00 python /home/data/crontab_chk_url/personas/trunk/plugins/spider/chk_url_status_30min.py
    root 2369 0.0 0.0 106108 1012 ? Ss Dec08 0:00 /bin/sh -c python /home/data/crontab_chk_url/personas/trunk/plugins/spider/cron_chk_url_status_ordertab_notexpire.py &> /dev/null;
    root 2371 0.0 0.0 439092 2720 ? Sl Dec08 0:05 python /home/data/crontab_chk_url/personas/trunk/plugins/spider/cron_chk_url_status_ordertab_notexpire.py
    root 3735 0.0 0.0 106108 1012 ? Ss Dec08 0:00 /bin/sh -c python /home/data/crontab_chk_url/personas/trunk/plugins/spider/chk_url_status.py &> /dev/null;
    root 3736 0.0 0.0 324348 2840 ? Sl Dec08 0:01 python /home/data/crontab_chk_url/personas/trunk/plugins/spider/chk_url_status.py
    root 3867 0.0 0.0 106108 1012 ? Ss Dec08 0:00 /bin/sh -c python /home/data/crontab_chk_url/personas/trunk/plugins/spider/chk_url_status_30min.py &> /dev/null;
    root 3871 0.0 0.0 324004 2632 ? Sl Dec08 0:01 python /home/data/crontab_chk_url/personas/trunk/plugins/spider/chk_url_status_30min.py
    root 4444 0.0 0.0 106108 1152 ? Ss 15:17 0:00 /bin/sh -c python /home/data/crontab_chk_url/personas/trunk/plugins/spider/chk_url_status_30min.py &> /dev/null;
    root 4445 0.0 0.4 320112 38628 ? Sl 15:17 0:01 python /home/data/crontab_chk_url/personas/trunk/plugins/spider/chk_url_status_30min.py
    root 6482 0.0 0.0 549796 6128 ? S Dec07 0:06 python DirectServer.py start
    root 6895 0.0 0.0 106108 1012 ? Ss Dec08 0:00 /bin/sh -c python /home/data/crontab_chk_url/personas/trunk/plugins/spider/chk_url_status.py &> /dev/null;
    root 6896 0.0 0.0 324276 2804 ? Sl Dec08 0:01 python /home/data/crontab_chk_url/personas/trunk/plugins/spider/chk_url_status.py
    root 6951 0.0 0.0 106108 1012 ? Ss 11:17 0:00 /bin/sh -c python /home/data/crontab_chk_url/personas/trunk/plugins/spider/chk_url_status_30min.py &> /dev/null;
    root 6952 0.0 0.0 324104 6044 ? Sl 11:17 0:01 python /home/data/crontab_chk_url/personas/trunk/plugins/spider/chk_url_status_30min.py
    root 7589 0.0 0.0 106108 1012 ? Ss 08:37 0:00 /bin/sh -c python /home/data/crontab_chk_url/personas/trunk/plugins/spider/cron_chk_url_status_ordertab_notexpire.py &> /dev/null;
    root 7590 0.0 0.0 362400 4996 ? Sl 08:37 0:05 python /home/data/crontab_chk_url/personas/trunk/plugins/spider/cron_chk_url_status_ordertab_notexpire.py
    root 7591 0.0 0.0 106108 1012 ? Ss 08:37 0:00 /bin/sh -c python /home/data/crontab_chk_url/personas/trunk/plugins/spider/chk_url_status_30min.py &> /dev/null;

    [root@hadoop2 ~]# ps -aux
    Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.8/FAQ
    USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND

    通过cut  获取进程号pid

    再通过xargs kill

    [root@hadoop2 ~]# ps -aux | grep chk | grep -v grep | cut -c 10-16 | xargs kill -9
    Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.8/FAQ
    [root@hadoop2 ~]# ps -aux | grep chk | grep -v grep | cut -c 10-16 | xargs kill -9
    Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.8/FAQ
    usage: kill [ -s signal | -p ] [ -a ] pid ...
    kill -l [ signal ]
    [root@hadoop2 ~]#

    业务写法

     ps -aux | grep chk | grep -v grep | grep Dec08 | cut -c 10-16 | xargs kill -9

  • 相关阅读:
    队列数据结构与算法JavaScript描述(5)
    栈数据结构与算法Javascript描述(4)
    散列数据结构与算法JavaScript描述(8)
    Evevt Loop、任务队列、定时器等
    OSGi初始篇
    应用服务平台与应用服务器
    数据源相关规范整理
    新手入门:教您最优的J2EE学习经验和流程
    TableView的使用
    Strategy
  • 原文地址:https://www.cnblogs.com/rsapaper/p/8011668.html
Copyright © 2020-2023  润新知