Find environment variables used by some process
Hi ALUG, Is it possible to query the environment variables being used by a specific process; from the outside? Specifically, I want to know if a running Apache has a particular environment variable set. Best, Richard -- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Richard Lewis ISMS, Computing Goldsmiths, University of London Tel: +44 (0)20 7078 5134 Skype: richardjlewis JID: ironchicken@jabber.earth.li http://www.richardlewis.me.uk/ -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Sent from my [insert device/mail clinet here]
On 14 Mar 13:18, Richard Lewis wrote:
Hi ALUG,
Is it possible to query the environment variables being used by a specific process; from the outside?
Specifically, I want to know if a running Apache has a particular environment variable set.
sudo cat /proc/<pid>/environ | tr '\0' '\n' Should do what you want. -- Brett Parker
At Mon, 14 Mar 2011 13:31:32 +0000, Brett Parker wrote:
On 14 Mar 13:18, Richard Lewis wrote:
Hi ALUG,
Is it possible to query the environment variables being used by a specific process; from the outside?
Specifically, I want to know if a running Apache has a particular environment variable set.
sudo cat /proc/<pid>/environ | tr '\0' '\n'
Should do what you want.
It does. Thanks. Best, Richard -- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Richard Lewis ISMS, Computing Goldsmiths, University of London Tel: +44 (0)20 7078 5134 Skype: richardjlewis JID: ironchicken@jabber.earth.li http://www.richardlewis.me.uk/ -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Sent from my [insert device/mail clinet here]
Richard, You should be able to look in /etc/$PID/environ to find the environment variables available. Beware - this file will prolly contain special chars which may break your terminal session display... HTH, Jim ----- Original Message ----- From: "Richard Lewis" <richardlewis@fastmail.co.uk> To: main@lists.alug.org.uk Sent: Monday, 14 March, 2011 1:18:21 PM Subject: [ALUG] Find environment variables used by some process Hi ALUG, Is it possible to query the environment variables being used by a specific process; from the outside? Specifically, I want to know if a running Apache has a particular environment variable set. Best, Richard -- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Richard Lewis ISMS, Computing Goldsmiths, University of London Tel: +44 (0)20 7078 5134 Skype: richardjlewis JID: ironchicken@jabber.earth.li http://www.richardlewis.me.uk/ -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Sent from my [insert device/mail clinet here] _______________________________________________ main@lists.alug.org.uk http://www.alug.org.uk/ http://lists.alug.org.uk/mailman/listinfo/main Unsubscribe? See message headers or the web site above!
participants (4)
-
Brett Parker -
Jim Rippon -
Richard Lewis -
Tim Green