![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Help needed in killing a process | stevefox | Shell Programming and Scripting | 10 | 04-03-2009 09:26 AM |
| Runaway SIGALRM signal handler | stewartw | High Level Programming | 8 | 04-11-2008 01:13 AM |
| process automation ...help needed | dr46014 | UNIX for Advanced & Expert Users | 6 | 10-21-2007 07:34 AM |
| Runaway processes killed (Really need help) | Micz | UNIX for Dummies Questions & Answers | 2 | 10-28-2003 02:45 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Runaway process. Opinions needed
not too long ago, i wrote a very short script that will bring up 4 customized xterms. The script went completely abnormal simply because of an error I had made in a while loop. This script took control of the system and rendered everything useless. The system admin team which i was part of tried every command we could think of to kill this damn script but nothing worked. We tried fuser -k, pkill etc. Fuser -k could have worked but this script had spawn way too many pids for fuser to handle. As fuser was killing them, hundreds more were being born. the output from the uptime command was mind blowing (over 240)
now, from reading countless numbers of books, i knew there was a way I could have killed the person who started this script, which was me but I couldn't remember what command it was. To make a long story short, we had to reboot the server inorder for it to work properly My question is, could there have been any other way we could have killed this process besides having to reboot it? I hate to fall in this same status quo again. |
|
|||||
|
RTM, this sounds like a "while(1) fork();" situation. Every single process is trying to make more copies of itself.
You can su to the user in question. Then you can do: "kill -9 -1" which will kill every process owned by that user. That is the trick that I think you are looking for. But: "kill -STOP -1" is more subtle. All of the user's processes will suddenly stop running. Then you can "kill -9" the bad guys. After the bad guys are gone, you can "kill -CONT" any good processes that you don't want to lose. If your shell does not have kill as a built-in, there is a problem... you probably can't start another process to run the kill command. If that happens, use: "exec /usr/bin/kill -9 -1" or whatever. |
|
||||
|
To tell you guys the truth, i panicked when this happened to me because i have never been a deadly situation like this before. I use to be that cautious admin that did only what he had to until i got lazier and decided to write more and more and more scripts.
anyway, the system was SunOS 5.8. and since i loved the bash shell and this particular script was being run in the bash shell, i issued the command "fuser -k /bin/bash" which seemed to work but the consistent rebirth of this never-dieing processes rendered this command ineffective mind you, if it wasn't for the fact that the system was getting slower and slower, i probably would have done something smarter but i had to think quicker than the rest of the admins in my team. am the one that messed up here. i think changing the ownership of the script that started this would have been the best way but "kill -9 -1" wouldn't have hurt to try out. by the way, how do i use that command? is it kill -9 -1 (the username) or what? |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|