Re: grab the complete commandline used ...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Stut schreef:
On 29 Aug 2008, at 19:46, Jochem Maas wrote:
David Otton schreef:
2008/8/28 Jochem Maas <jochem@xxxxxxxxxxxxx>:
I have a feeling I'm out of luck - probably security issues that keep
you from doing such a thing as well.

I did have the idea of grabbing the PID and then grepping the output of
ps via exec() ... that would do it, but I reckon it smells. :-)
That won't work.

in what sense won't it work? the complete line is in the output of ps somewhere
albeit after wildcard/shell expansion.

Quote the entire command as a string. Pass it to a shell script that
sets an environment variable to that string, then executes the string.

if life were that simple. it's user X running the php script from the
commandline ... I wanna know exactly what he is doing (which is not
necessarily the same as what he should be doing). I only really control
the php script in question not the context it is run in.

I think the only way to do what you want is to parse the output from ps with appropriate arguments. You'll probably need to find the parent process of your PHP script.

yeah, the 'grab the PID' explaination was too simplistic, actually I should
be able to grep on the scriptname - it will only run if no other instances are
already running (race conditions aside ;-))

Don't think you're going to find a portable way to do it.

portability not needed beyond linux and MacOS. thank goodness :-)
at least it's doable ... and the smell will be running on someone else's
hardware :-P


-Stut



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux