# HG changeset patch # User Jeff Hammel # Date 1371941901 25200 # Node ID 481b55fc4b96ddc6f1bdaae521853197ae7835b6 # Parent 4387fa22807f195b6b957967305bae86cbc2e467 added utility to get process env variables diff -r 4387fa22807f -r 481b55fc4b96 bin/procenv.sh --- /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