Mercurial > hg > config
changeset 342:481b55fc4b96
added utility to get process env variables
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Sat, 22 Jun 2013 15:58:21 -0700 |
parents | 4387fa22807f |
children | 71345f4de3ce |
files | bin/procenv.sh |
diffstat | 1 files changed, 25 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/procenv.sh Sat Jun 22 15:58:21 2013 -0700 @@ -0,0 +1,25 @@ +#!/bin/bash + +# process environment +# list process environment variables + +# must be run as root +if [[ "$(whoami)" != "root" ]] +then + echo "must be run as root" + exit 1 +fi + +# loop over arguments +for PROG in $@ +do + EXIT=0 + if PID=$(pidof -x ${PROG}) + then + echo '='${PROG}: ${PID}'=' + cat /proc/${PID}/environ | tr '\000' '\012' | sort + else + EXIT=1 + echo "" + fi +done \ No newline at end of file