tags:

views:

179

answers:

4

Any way to do this?

I have a script that exports a few vars and runs a component.

I'm looking to find out the actual values of some of these vars while the process is running. (Which applies here, because I'll be incorporating those values into another script/program)

The vars themselves are PID specific (I'm quite new at this, if that wasn't obvious. Haha!)

Thanks!

+1  A: 

You can query /proc/PID/environ for all defined envvars

ennuikiller
A: 

I don't sure I understand your question. but ... If you in your bash script export some environment variables, than this will be in the environment of process it is executing (this since child process derives all environment variable of process created it).

dimba
A: 

I checked the environ file for that process, but oddly, it doesn't contain all the defined env vars for that process in and of itself.

The exported variables will be specific to a process, but I won't always know them. I'm looking to query which env vars are specific and declared for a process, and what their values are.

Monster
A: 

Hmm, If I understand correctly - I think i would make the script respond to a "kill" signal so as to extract it's runtime information using "trap". You could write the metadata to stdout potentially.

Maybe trap SIGHUP in your script, and make it write to stdout?

jskaggz