RE: oninit -i -y from PHP - cannot detect that command have exited
Posted in 2000
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi Jonathan,
thanks for answer!
> Andrej Falout wrote:
> > This little saga have to do with IDS (7.3 LE) oninit command, when
> > executed from PHP code using exec() or system()
>
> Running "oninit -iy" from anything is inherently implausible to my
> way of thinking. What are you up to? Why would you want to create
> a database instance on the fly?
Because I'm building an ASP system, and each company using our ERP
apps in ASP system over the internet will need separate database
space.
Why not just database? Because you can individually tune instance for
specific customers and it is generally easier to manage. Also most
customers don't like the idea of keeping there database in same
instance with other companies.
> It strikes me as being a fairly bad idea! At the very least, you
had
> better have darn good security controls on who can actually do that.
Yes I do. And even if this fails, worst thing that can happen is that
you will be able to create an database instance with fixed size, and
that is it. You cannot kill existing instance, and you cannot overload
my space. So if someone enjoys braking in my system to make a lot of
empty instances, knock yourself out... Don't forget that you will have
to enter your credit card number first. Thank you.
> > Problem is, when PHP executes oninit like this, oninit runs fine,
I can
> > see my db space being created, but PHP just hangs there waiting
for
> > command to return to PHP, and it never does.
>
> Maybe oninit looks at some environmental factors (such as "is stdin,
> stdout or stderr a terminal; if so, I need to do a forking start,
but
> otherwise I don't")
No, oninit works without any problems. It successfully builds root
space.
If I run my script, root space will be built, and engine will be left
in on-line mode. Script will exit, but PHP will not resume control. If
I at that moment go to terminal window, and a) shutdown this engine,
or b) just kill ALL oninit processes on the box, PHP WILL IMMEDIATELY
RESUME CONTROL FROM THE SHELL SCRIPT OUTPUT FROM PHP TO THE BROWSER
WILL IMMEDIATELY CONTINUE.
Apparently, PHP exec() is monitoring what is started/forked/spawned
with it, and if it see any of this processes running when command
exits, it assumes command is not done.
> I'd hypothesize that at the point when exec or system doesn't
return, it
> is
> because oninit has not exited. That's more likely than a breakage
in
> PHP.
It is, and I agree, but why does PHP care about it? In my view, it
should care jus about the command that was launched with it, and if it
is an shell script or whatever, what goes one in there should not be
of PHP's interest?
> Try running the script with i/o redirection:
>
> script >/dev/null < /dev/null 2>&1
slash/back-slash/left-curly-bracket/dot/man/this/su***/
When will I understand what is going on here? Now if you can answer
THAT! :-)
Of course, you are right, again, it works fine, and I am very
grateful. It was enough to change just oninit line in my shell script
to:
oninit >/dev/null < /dev/null 2>&1
Thank you very much,
Yours, Andrej Falout, http://www.falout.com ICQ 7628616
#-----------------------------------------------------------------
globals "std_disclaimer.4gl"
"Venus is still under construction. Thank you for your patience
and we apologize for the inconvenience." - Match.com online dating
site.
-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 6.0.2i
iQA/AwUBOUivGhZH34ibpTRkEQLYxACg4QT3uGU12KU/ovY9bb6T5YFTAQkAnieE
Tw3hNBYfUMoOLSR6Z1Xb10ZV
=ndrV
-----END PGP SIGNATURE-----