Crond and Zombies

Crond and Zombies

Post by Jordan Ritt » Wed, 12 Feb 1997 04:00:00



Ok, I have a zombie process:
---
ps auxj:
 PPID   PID  PGID   SID TTY TPGID  STAT   UID   TIME COMMAND
 4516  4519  4519  4519  ?     -1  Z     525   0:00 (sh <zombie>)
---

I find it's parent ID at:
---
ps aux | grep CROND
USER       PID %CPU %MEM  SIZE   RSS TTY STAT START   TIME COMMAND
root      4516  0.0  0.6   840   392  ?  S   21:50   0:00 CROND
---

Strange; I already have a crond running (loaded at system startup):

---
ps aux | grep crond
USER       PID %CPU %MEM  SIZE   RSS TTY STAT START   TIME COMMAND
root       112  0.0  0.6   840   396  ?  S  Feb 10   0:00 crond
---

And I can't find "CROND" anywhere on the system.

I have users that utilize cronjobs, so obviously something is zombiing. I
have seen the offending shell script (run from cron), and all it does is do a
ps aux searching for a certain program in memory, uses AWK for formatting,
and then loads the program if it's not loaded already.

Here's the shell script:

----
#!/bin/bash
RUNNING=`ps aux | awk '($11=="prog" || $12=="prog") { print $2 }'`

if [ -z $RUNNING ]; then
    cd /home/theirhomedir
    ./prog
fi
----

** My question is this:

If Crond zombies, does it automatically set it's name to all caps? I KNOW
there's no "CROND" anywhere on the entire system.

BTW, this is the latest Vixie Cron available for RedHat 4.0.

Any information would be greatly appreciated.

--

Jordan Ritter
EECS Department, Packard Bldg.
Lehigh University
Bethlehem, PA

--------------------------------------------------
 Customer:      "I'm running Windows '95."
 Tech Support:  "Yes."
 Customer:      "My computer isn't working now."
 Tech Support:  "Yes, you said that."
--------------------------------------------------

 
 
 

Crond and Zombies

Post by B.A.McCau.. » Fri, 14 Feb 1997 04:00:00



Quote:>ps auxj:
> PPID   PID  PGID   SID TTY TPGID  STAT   UID   TIME COMMAND
> 4516  4519  4519  4519  ?     -1  Z     525   0:00 (sh <zombie>)

AFAIK crond doesn't do a waitpid() on it's children until they have
closed the pipe that links them to cron.

This means that if a child of cron forks off and dies without closing
or redirecting both stdout and stderr you'll get a zombie.

Quote:>Here's the shell script:

>----
>#!/bin/bash
>RUNNING=`ps aux | awk '($11=="prog" || $12=="prog") { print $2 }'`

>if [ -z $RUNNING ]; then
>    cd /home/theirhomedir
>    ./prog
>fi

What does prog do?  Does it perhaps fork-off-and-die?  If so you
should try:

./prog >/dev/null 2>/dev/null

Quote:>If Crond zombies, does it automatically set it's name to all caps? I KNOW
>there's no "CROND" anywhere on the entire system.

I think it does it when it fork()s so that you can easyily spot the
real crond.

Quote:>BTW, this is the latest Vixie Cron available for RedHat 4.0.

Really?  I thought Vixie Cron was usually called just "cron" bot "crond".

--

 .  _\\__[oo       from       | Phones: +44 121 471 3789 (home)

.  l___\\    /~~) /~~[  /   [ | PGP-fp: D7 03 2A 4B D8 3A 05 37...
 # ll  l\\  ~~~~ ~   ~ ~    ~ | http://wcl-l.bham.ac.uk/~bam/