Need a script to kill processes with PPID of 1

Hi,
I have been trying to come up with a script to run as a cron job to kill any processes that have PPID of 1. I have created a file that contains the PID and the PPID. How can I read this file and then execute a kill on any PID where PPID is 1. The file looks like this:

4904 1
4455 1
6561 6560
5678 1

I create the file using:
ps -ef|grep -v root|grep rp_h1|awk '{print $2 , $3}' > killog

Then I want to read the killog file and issue a kill -9 on each PID that has a PPID of 1. This seems like it should be simple, but I am not very good with script writing. Thanks in advance for your help!!!

Lori

you could also do the code below but I wouldn't advise doing what you think you should be doing as more than a few system processes have PPID 1 (check "ps -ef | grep inetd") ...

kill -9 `ps -ef | awk '$3 == 1 {print $2}'`

however, you can restrict to non-root user processes ...

kill -9 `ps -ef | awk '$3 == 1 && !/root/ {print $2}'`

ummm...you are not going to be able to kill all processes with a PID of 1. Besides, why would you want to do that? See article here

Yes, you are right about the killing of all processes with PPID of 1. My problem initially stems from my oracle application server report printing. Every day there are about 50 processes left hanging after the batch printing finishes

example:
oracle 5321 1 0 Apr 04 ? 0:00 lp -d rp_h1-batch2_lp

So what I really want is to specify that this type of process be cleaned up. Right now I have to manually do them every few days. I could match up the character string of rp_h1, which is what I do with my grep statement in my initial posting, that way I would not eleminate any processes uneccesarily.
That was why I was doing the grep and excluding root and specifying a character string then writing to a file. I'm going to mess around with Ice's suggestions and see what I can come up with. Thanks and further advice will be appreciated!!

if you just needed rp_h1 ...

kill -9 `ps -ef | awk '$3 == 1 && /rp_h1/ {print $2}'`

Worked like a charm!! Thank you Thank you Thank you.