[FreeNX-kNX] Sanity check...

Ed Warnicke eaw at cisco.com
Sun Apr 24 01:12:30 UTC 2005


On Saturday 23 April 2005 07:19 pm, you wrote:
> Am Samstag, 23. April 2005 23:04 schrieb Ed Warnicke:
> > Wouldn't it be a better solution to move the:
> >
> > NX> 710 Session status: running
> > into the monitor if clause:
> >
> > if stringinstring "Info: Waiting for connection from" "$line"
> >
> > That way you would never get the nxclient sending
> > "bye" before the nxagent was actually up and awaiting
> > connections?  This *should* also take care of the spurious
> > "NX>" problem as well.
>
> Yes, this sounds like a good idea. I'll try it out.
>
> > You could then have your netcat line be something like:
> >
> > netcat 127.0.0.1 $PROXY_DISPLAY &
> > echo_x "Bye"
> > echo_x "NX> 999 Bye"
> > wait $!
> >
> > so that nxserver ONLY responds to nxclient with it's
> > Bye message once all of the pipes are hooked up.
> > (Please note, the above example is very rough,
> > you'd want to check various exit code to make
> > sure the pipe really are hooked up.)
>
> There is a problem on that one ... You can't check the exit code with & ...
Actually :)  You can :)

wait will return the exit code of the process being waited on... so after
wait $!
you will find that 
$?
is the return code of the backgrounded netcat :)

>
> But I don't think putting the netcat after sending Bye is too problematic.
> Not with the proposed exec 1>&2 anyway ...

Please note, the suggested moving things around removes
the need for the exec 1>&2 suggestion as it corrects (I think)
the state machine...

Ed



More information about the FreeNX-kNX mailing list