Unix Programming - request a looping process script

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > February 2005 > request a looping process script





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author request a looping process script
mia456789@yahoo.com.hk

2005-02-21, 7:54 am

I am not too understand shell script writing , could someone can help
me ,

I want to have a shell script for testing , the process will run
repeatly (looping), I want to test the CPU time , I have the below
script to test :

while x=0
do
cp /tmp/abc.txt /tmp/def.txt
done

the process is non-stop running , but it is not fit my requirement ,
because the above script will generate a new process after the old
process was completed , what I want is a SAME process is running a
non-stop process (same PID ) ,

More clearly , I just want to have a script to run a process ( may be
a looping ) , this process need to use the same PID . In my previous
script , after the cp process finished , it will generate another
process ( so the PID changed ) so not fit my requirement.
could someone can post the script that can do that? thx in advance.
Jens.Toerring@physik.fu-berlin.de

2005-02-21, 6:00 pm

mia456789@yahoo.com.hk wrote:
> I am not too understand shell script writing , could someone can help
> me ,


> I want to have a shell script for testing , the process will run
> repeatly (looping), I want to test the CPU time , I have the below
> script to test :


> while x=0
> do
> cp /tmp/abc.txt /tmp/def.txt
> done


> the process is non-stop running , but it is not fit my requirement ,
> because the above script will generate a new process after the old
> process was completed ,


Yes, of course, what else do you expect? The script can only continue
when the process created for doing the 'cp' is finished and exits.

> what I want is a SAME process is running a non-stop process (same PID ) ,


Forget it. Once the process is dead you can't revive it. And you also
don't have any control over the PID the next process started will get,
if the PID is what you are interested in.

Better explain what exactly you want to do, not how you assume you
can achieve it.
Regards, Jens
--
\ Jens Thoms Toerring ___ Jens.Toerring@physik.fu-berlin.de
\__________________________ http://www.toerring.de
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com