Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
I had to come up with something evil yet playful for my 666th post, this is it.

I wish i could have obfuscated it, but alas. And yes, this for *NIX systems only (sorry Darwin users, deprecated confirmed that you are out to). The processes themselves are not really zombie processes - that would be...too evil. >:)

WARNING: don't run this if you don't know how to kill processes! (and don't forget about 'killall' and -9 for the occasional 'Super Zombie'!) ;)

#!/usr/bin/perl -lw use strict; # necromancer my $zombie,$|++,print $/; $SIG{TERM} = sub { hit $zombie; destroy $zombie and return unless $zombie->walks; print qq|"BRAINS!" (|,$zombie->health,' left)'; }; for (1..6) { next if fork; $zombie = raise Zombie; sleep 1 and regen $zombie while 666; } package Zombie; sub raise {print "$$ rises" and bless {hits=>int(rand 5)+2},shift} sub hit {shift->{hits}--} sub walks {shift->{hits} > 1} sub health {$_=shift->{hits};$_ > 1 ?"$_ hits":"$_ hit"} sub regen {shift->{hits}+=3 if int(rand 2)} sub destroy{print qq|"brainsss..." zombie destroyed| and exit}

P.S. deprecated tells me that some Unix systems do not have 'killall', 'pgrep', or 'pkill' handy. He recommends using this for such systems instead:

kill `ps Af | grep perl | grep -v grep | awk '{ print $2 }'`
"sometimes its ps -ef sometimes its ps -xawu and so on. solaris does have pgrep and pkill (but not before 2.6), and many of the BSD's (free open and net) will not have either so the awkkill is necessary."

Thanks deprecated! I named this script zombie.pl, so i would replace 'perl' in the line above with zombie.pl. Don't forget that you can add -9 to 'kill' in the line above as well, but that takes all the fun out! Happy Hunting! ;)

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)

In reply to Zombie Hunter (666th post) by jeffa

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others lurking in the Monastery: (12)
    As of 2019-10-17 16:29 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      Notices?