http://qs321.pair.com?node_id=254735


in reply to fork-bomb!

I'm an admin on a few systems that get fork-bombed accidentally a few times a semester (big computers used by students in begining OS courses). There is something you can do if you catch it while it's going on, though, as long as you do a little planning ahead. On those machines I keep about four shells nested.
exec tcsh set prompt="THIS IS YOUR LAST SHELL# " tcsh tcsh tcsh tcsh
(cut and paste into the terminal). Then if I notice the machine is going to Hell, I can "exec top" and "exec pkill -u person" and things like that. Although you can no longer get any new pids, you're quite free to sacrifice shells for that one last desperation command. Just a little tip, in case anyone is interested.

Replies are listed 'Best First'.
Re: exec, nested shells
by Xanatax (Scribe) on May 04, 2003 at 19:50 UTC

    ok, _that_ was what is was trying to find info on! couldn't figure out how to burn the pids i still had in shells on things like kill or shutdown. thanks!

    the nested shells is a neat idea also... actually, that's really easy and convenient to setup with 'screen' also. i generally end up with at least eight shells running because of wonton use of windows in screen, so having spare pids is more likely than not.

    i just added an init line to the system to make screen start a half-dozen shells for the root account, so as long as i have a connection to the machine i will have those available for emergencies.

    -- Xanatax.

Re^2: fork-bomb!
by Hue-Bond (Priest) on Sep 11, 2005 at 18:55 UTC

    One could also use psh and exploit the feature of being able to execute Perl code without forking.

    --
    David Serrano

Re: Re: fork-bomb!
by Juerd (Abbot) on May 02, 2003 at 07:49 UTC