[sllug-members]: Command to Execute command continuously
Lamont R. Peterson
lamont at gurulabs.com
Wed Jun 21 03:27:08 MDT 2006
On Wednesday 21 June 2006 12:27am, Randy Clements wrote:
> I just realized I could call the script itself at the end of the script.
> And that seems to be working a bit. However, is there a better way to do
> what I want to do??
That's a bad idea. Here's why:
Step 1. You launch your script. When you do so, the shell forks another copy
of the shell with a separate process ID (PID) and it executes.
Step 2. At the end of the script, it calls itself, forking another shell like
in step 1. This shell process will not exit until the command just called
exits.
Step 3. Repeat step 2.
So you end up with a process tree like:
bash ./script
bash ./script
bash ./script
bash ./script
bash ./script
bash ./script
bash ./script
bash ./script
bash ./script
bash ./script
bash ./script
...
And so on.
Now, this really won't cause a big problem unless you let it run log enough to
consume all of your available PIDs. But it's still quite inefficient.
[snip]
--
Lamont R. Peterson <lamont at gurulabs.com>
Senior Instructor
Guru Labs, L.C. [ http://www.GuruLabs.com/ ]
GPG Key fingerprint: F98C E31A 5C4C 834A BCAB 8CB3 F980 6C97 DC0D D409
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://sllug.org/pipermail/sllug-members/attachments/20060621/efa066b0/attachment.pgp
More information about the sllug-members
mailing list