Traduisez - Übersetzen - Traduzca - Traduza - Tradurre - Translate

VanLUG Email Archive

VanLUG Mailing List
Re: Script to wait?

New Message Reply About this list Date view Thread view Subject view Author view

Taj Khattra (taj@intergate.bc.ca)
Tue, 20 Oct 1998 22:43:52 -0700 (PDT)


Brian Edmonds wrote:
> Some people have posted funky ps&grep things to check for the existance
> of a particular pid. If you're not concerned with ultra portability,
> then under Linux (and some other Unixes, but by no means all), you just
> have to check for the existance of files in /proc. Under Linux if pid X
> is a running process then there will be a directory /proc/X.

> #!/bin/sh
> # example of waiting for a pid (our argument) to end
> while [ -d /proc/$1 ]; do sleep 5; done
> echo "Done!"

another simple and portable method is:

        while kill -0 $1 2>/dev/null; do sleep 1; done

-taj


New Message Reply About this list Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b3 on Mon 02 Nov 1998 - 03:23:18 PST