AIX

AIX

Connect with fellow AIX users and experts to gain knowledge, share insights, and solve problems.


#Power
#Power
 View Only
  • 1.  How do I kill a runaway process which continue generating new processes

    Posted Fri February 13, 2009 05:42 PM

    Originally posted by: SystemAdmin


    A user runs a script which continues to generate new processes due to a bug. I use the following script to kill the processes but the killing is not fast enough:

    ps -ef | grep the_user >list
    while read a b c; do (echo $b;kill -9 $b) done <list

    I am wondering if there is a way to kill all his processes without shutdown the machine. Thanks.
    #AIX-Forum


  • 2.  Re: How do I kill a runaway process which continue generating new processes

    Posted Fri February 13, 2009 07:47 PM

    Originally posted by: dukessd


    you could give your script a higher run priority with nice / renice / setpriority in the hope it will get a lot more system time than the rouge script.

    Otherwise I think you are looking at a reboot.
    #AIX-Forum


  • 3.  Re: How do I kill a runaway process which continue generating new processes

    Posted Mon February 16, 2009 10:17 AM

    Originally posted by: MarkTaylor


    su - idiot_user -c "kill -9 -1"

    Then disable his account ;)

    HTH
    Mark Taylor
    #AIX-Forum


  • 4.  Re: How do I kill a runaway process which continue generating new processes

    Posted Mon February 16, 2009 10:20 AM

    Originally posted by: tony.evans


    Kill the parent process(es)?
    #AIX-Forum


  • 5.  Re: How do I kill a runaway process which continue generating new processes

    Posted Wed February 18, 2009 05:48 PM

    Originally posted by: SystemAdmin


    Thanks all for your replies. The problem is that the runaway script is like a virus which is self-duplicating. Fortunately the user has a ulimit for the number of threads (several thousands) he can create therefore the number of processes stop increasing after the ulimit is reached. However any time you kill a process, a new process is created by the remaining process. Unless you can kill all processes at the same time you can not kill all of them.

    I found a way to kill them by first sending SIGSTOP (17) to all of them, then killing them one by one.

    ps -ef | grep user_name >list; while read a b c; do (echo $b;kill -17 $b) done <list >/dev/null 2>&1
    ps -ef | grep user_name >list; while read a b c; do (echo $b;kill -9 $b) done <list >/dev/null 2>&1
    #AIX-Forum