home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


UNIX Power Tools

UNIX Power ToolsSearch this book
Previous: 38.13 Interactively Kill Processes Matching a Pattern Chapter 38
Starting, Stopping, and Killing Processes
Next: 38.15 Cleaning Up an Unkillable Process
 

38.14 Processes Out of Control? Just STOP Them

Especially if you're a programmer, you can run into a situation where you have processes forking (38.2 ) out of control - more and more of them. By the time you kill one, fifty more fork.

  • On systems with job control (12.1 ) , there's a good answer: use the STOP signal to stop the processes:

    kill
     
    kill -STOP
    
     ...

    Stop any process you can. Then it won't be able to fork more processes. Stop them all. Then start cleaning up with kill -9 .

  • If your system manager has set a per-user process limit on your computer, the good news is that your processes won't eventually crash the system. But the bad news is, when you try to run any command that isn't built into the shell (1.10 ) :

    % ps
    
    
    No more processes.

    you can't because you're already at your limit.

    If that happens, log on to another account or ask someone to run a command that will give a list of your processes. Depending on your system, the command is probably like one of these two:

    % ps -u
    
     yourname
    
       System V
    
    % ps aux | grep 
    
    yourname
    
       BSD
    

    Then go back to your terminal and start stopping :-) . If you get the No more processes error, your shell must not have a built-in kill command. The C shell does. Carefully type the next command to replace your shell with a C shell. Don't make a mistake (if you do, you may not be able to log in again):

    exec
     
    $ exec /bin/csh
    
    
    % kill
    
     ...

- JP


Previous: 38.13 Interactively Kill Processes Matching a Pattern UNIX Power Tools Next: 38.15 Cleaning Up an Unkillable Process
38.13 Interactively Kill Processes Matching a Pattern Book Index 38.15 Cleaning Up an Unkillable Process

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System