The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Kill all users processes command

Discussion in 'General Discussion' started by demomen, May 30, 2005.

  1. demomen

    demomen Well-Known Member

    Joined:
    Sep 25, 2004
    Messages:
    111
    Likes Received:
    0
    Trophy Points:
    16
    Hi, i've tried this skill -9 USERNAME - to try and kill a user when they keep pckacct's
    but it does not seem to stop it at all, so back to the normal kill -9 PID

    Anyone tell me how to kill all a users processes, everything they are doing.
     
  2. cPanelBilly

    cPanelBilly Guest

    skill does not expect a user but a process or processid.

    I would recommend using a ps + awk/gawk command.
     
  3. dgbaker

    dgbaker Well-Known Member
    PartnerNOC

    Joined:
    Sep 20, 2002
    Messages:
    2,578
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    Toronto, Ontario Canada
    cPanel Access Level:
    DataCenter Provider
    A sample command would look like so;

    for i in `ps -ef |grep USERNAME|awk '{print $2}'`;do kill -9 $i;done

    No access to test this at the moment so re-verify it first for syntax.
     
    #3 dgbaker, May 30, 2005
    Last edited: May 30, 2005
  4. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    n/m ignore me :eek:
     
  5. dgbaker

    dgbaker Well-Known Member
    PartnerNOC

    Joined:
    Sep 20, 2002
    Messages:
    2,578
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    Toronto, Ontario Canada
    cPanel Access Level:
    DataCenter Provider

    ????? Did I miss something? :D
     
  6. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    You're just trying to embarrass me now :)

    I contradicted Billy as the skill man page indicates otherwise (and "appears" to kill username processes using the STOP signal). But I tested it and it appears to not work correctly, so I thought I'd remove my comments ;)
     
  7. demomen

    demomen Well-Known Member

    Joined:
    Sep 25, 2004
    Messages:
    111
    Likes Received:
    0
    Trophy Points:
    16
    Thanks, what is the "i" for, I tried the below but it gives an error


    root@ [~]# `ps -ef |grep test|awk '{print $2}'`;do kill -9 $i;done
    bash: syntax error near unexpected token `do'
    root@ [~]#
     
  8. dgbaker

    dgbaker Well-Known Member
    PartnerNOC

    Joined:
    Sep 20, 2002
    Messages:
    2,578
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    Toronto, Ontario Canada
    cPanel Access Level:
    DataCenter Provider
    You missed the first part of the command. Copy/type the ENTIRE line.

    Code:
    for i in `ps -ef |grep USERNAME|awk '{print $2}'`;do kill -9 $i;done
    It basically means-
    for the results found in this command, do this command on each result set.
     
  9. demomen

    demomen Well-Known Member

    Joined:
    Sep 25, 2004
    Messages:
    111
    Likes Received:
    0
    Trophy Points:
    16
    Thanks, it appears to work :)
     
  10. X-Istencedotcom

    X-Istencedotcom Well-Known Member

    Joined:
    Apr 14, 2003
    Messages:
    223
    Likes Received:
    0
    Trophy Points:
    16
    For FreeBSD:

    su <user> -c kill -9 -1
     
Loading...

Share This Page