Problem on SSH kill process

Discussion in 'Site & Server Administration' started by alan8888, Jul 16, 2007.

  1. #1
    :confused: I am using Gatorhost right now, I bought one of the script in this DP forums and testing it. I get screw on the Sharehost account most of the time. it said I have limited 25 process. So I tried to access the SSH to kill the process by my own
    but the Problem is I already limit the account process, So even I can logon I can't do anything on it
    I tried top , ps -aux theses command
    It give me : fork: Resource temporarily unavailable

    1) is there anyway I can kill all process without knowing their process ID or name. I have heard about some script, but have no idea how to load on the server,
    2) I have read online I can use PHP funtion posix_getpid to get the PID, but then it ask me to configure the file on the etc/php.ini but I can't find this file on my ftp and I don't know how to configure as well.
    I found it in here
    http://www.modwest.com/help/kb20-328.html

    may be is becoz of different hosting company, things seem different.
     
    alan8888, Jul 16, 2007 IP
  2. ajsa52

    ajsa52 Well-Known Member

    Messages:
    3,426
    Likes Received:
    125
    Best Answers:
    0
    Trophy Points:
    160
    #2
    Because you can't run new process (top, ps, ...) from your shell, you won't run kill from shell neither.
    But this could work: make an shell file (chmod 755) and put there your desired commands: ps, kill, ... and then run it with "dot" command:
    
    . ./mykill.sh
    
    Code (markup):
    If that doesn't work, maybe adding those commands on your .profile could work.
     
    ajsa52, Jul 16, 2007 IP
  3. alan8888

    alan8888 Active Member

    Messages:
    368
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    58
    #3
    Sorry I am a newbie on SSH , just start to use last night
    So now I should use a notepad
    and type"

    #!/bin/sh

    ps

    "
    and save it as ps.sh

    After that where should I put the file ???
    and how can I run it ?
    thx
     
    alan8888, Jul 16, 2007 IP
  4. ajsa52

    ajsa52 Well-Known Member

    Messages:
    3,426
    Likes Received:
    125
    Best Answers:
    0
    Trophy Points:
    160
    #4
    Yes, ps.sh is ok.
    You can upload to your hosting machine via rcp or with any ftp program.
    Any directory with permission will work, and remember to add executable permission (+x), example: "chmod 755 ps.sh"
    Finally access to that directory with ssh, and run ps.sh shell. Example
    
    ssh user@machine.com
    cd testDirectory
    . ./ps.sh
    
    Code (markup):
     
    ajsa52, Jul 16, 2007 IP
  5. CowGame

    CowGame Peon

    Messages:
    68
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #5
    You can find your process by doing ps -l | grep yourusername, to see all the process that you have started with your id. Then you can kill it.
     
    CowGame, Jul 16, 2007 IP
  6. alan8888

    alan8888 Active Member

    Messages:
    368
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    58
    #6
    there is nth u can do about it..
    can't even run anything.

    alan8888@gator235 [~/test]# kill
    kill: usage: kill [-s sigspec | -n signum | -sigspec] [pid | job]... or kill -l [sigspec]
    alan8888@gator235 [~/test]# . ./ps.sh
    : command not found
    PID TTY TIME CMD
    9596 ? 00:00:00 bash
    14519 ? 00:00:00 ps
    alan8888@gator235 [~/test]# . ./ps.sh
    -jailshell: fork: Resource temporarily unavailable
    alan8888@gator235 [~/test]# . ./ps.sh
    -jailshell: fork: Resource temporarily unavailable
    alan8888@gator235 [~/test]# ps
    -jailshell: fork: Resource temporarily unavailable
    alan8888@gator235 [~/test]# top
    -jailshell: fork: Resource temporarily unavailable
    alan8888@gator235 [~/test]# ps -aux |grep alan8888
    -jailshell: fork: Resource temporarily unavailable
    alan8888@gator235 [~/test]#
     
    alan8888, Jul 16, 2007 IP
  7. alan8888

    alan8888 Active Member

    Messages:
    368
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    58
    #7
    I wish someone can teach me to use the posix_getpid on php and get the PID
     
    alan8888, Jul 16, 2007 IP