From: Sashi on
Hi all, I want to run a script that runs a few DB updates after the
insertion is done.

I've kicked of the insertion script in a window, but it'll run for 4
hrs.

I tried to see if I could wait for this script so that I can schedule
the update script.

I googled around and the wait command seems to work only for the
current shell.
I'm on solaris 10, with bash 3.0.
Is there a way to wait for a process from another shell to finish?

I've implemented it clumsily using a while loop that sleeps for 5 min
before checking for the insertion script. Once the while loop exits,
my update script will kick in.

I'd like to see a more elegant/efficient solution.

TIA,
Sashi
From: Barry Margolin on
In article
<c232caa4-8e3d-45b7-8a2a-c2669e08220a(a)a5g2000yqi.googlegroups.com>,
Sashi <smalladi(a)gmail.com> wrote:

> Hi all, I want to run a script that runs a few DB updates after the
> insertion is done.
>
> I've kicked of the insertion script in a window, but it'll run for 4
> hrs.
>
> I tried to see if I could wait for this script so that I can schedule
> the update script.
>
> I googled around and the wait command seems to work only for the
> current shell.
> I'm on solaris 10, with bash 3.0.
> Is there a way to wait for a process from another shell to finish?
>
> I've implemented it clumsily using a while loop that sleeps for 5 min
> before checking for the insertion script. Once the while loop exits,
> my update script will kick in.
>
> I'd like to see a more elegant/efficient solution.

Sorry, processes can only wait for their direct children. For any other
kind of synchronization, you have to use some other mechanism.

Why don't you just put everything in one script?

--
Barry Margolin, barmar(a)alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
From: Sashi on
On Feb 11, 8:38 pm, Barry Margolin <bar...(a)alum.mit.edu> wrote:
> In article
> <c232caa4-8e3d-45b7-8a2a-c2669e082...(a)a5g2000yqi.googlegroups.com>,
>
>
>
>  Sashi <small...(a)gmail.com> wrote:
> > Hi all, I want to run a script that runs a few DB updates after the
> > insertion is done.
>
> > I've kicked of the insertion script in a window, but it'll run for 4
> > hrs.
>
> > I tried to see if I could wait for this script so that I can schedule
> > the update script.
>
> > I googled around and the wait command seems to work only for the
> > current shell.
> > I'm on solaris 10, with bash 3.0.
> > Is there a way to wait for a process from another shell to finish?
>
> > I've implemented it clumsily using a while loop that sleeps for 5 min
> > before checking for the insertion script. Once the while loop exits,
> > my update script will kick in.
>
> > I'd like to see a more elegant/efficient solution.
>
> Sorry, processes can only wait for their direct children.  For any other
> kind of synchronization, you have to use some other mechanism.
>
> Why don't you just put everything in one script?
>
> --
> Barry Margolin, bar...(a)alum.mit.edu
> Arlington, MA
> *** PLEASE post questions in newsgroups, not directly to me ***
> *** PLEASE don't copy me on replies, I'll read them in the group ***


Thanks for the reply, Barry. I kicked off the script and then realized
that I needed the second script run, so thought of doing something
about it.
I don't mind my primitive solution. It works, but feels inelegant.
Usually Unix has features to do pretty much anything that you can
dream of.
Sashi
From: Greg Andrews on
Sashi <smalladi(a)gmail.com> writes:
>
>Is there a way to wait for a process from another shell to finish?
>

Not with the 'wait' command built into the shell, but you can
do something very close with the /usr/bin/pwait external command.

Your script that invokes pwait must be running as a user who can
attach to the process that you want to wait for. Usually this
means you're running as the same user.

See the "man pwait" manual page (which is shared with a collection
of other useful commands, most especially pwdx and pfiles). One or
two of those commands are also available on other operating systems,
but most of them are only on Solaris.

-Greg
--
::::::::::::: Greg Andrews ::::: gerg(a)panix.com :::::::::::::
I have a map of the United States that's actual size.
-- Steven Wright
From: bsh on
On Feb 11, 5:07 pm, Sashi <small...(a)gmail.com> wrote:
> Hi all, I want to run a script that runs a few DB updates after the
> insertion is done.
> ...

> I'd like to see a more elegant/efficient solution.

A "stupid" solution?

Try Dan Mercer's idea:

http://groups.google.com/group/comp.unix.shell/browse_thread/thread/b330f4788a7c93ac/d1c0b83be51e341f

=Brian