Mercurial > hg > config
annotate bin/procenv.sh @ 436:651caa15d80f
.conkyrc
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Thu, 08 Aug 2013 10:51:26 -0700 |
parents | 481b55fc4b96 |
children |
rev | line source |
---|---|
342
481b55fc4b96
added utility to get process env variables
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
1 #!/bin/bash |
481b55fc4b96
added utility to get process env variables
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
2 |
481b55fc4b96
added utility to get process env variables
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
3 # process environment |
481b55fc4b96
added utility to get process env variables
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
4 # list process environment variables |
481b55fc4b96
added utility to get process env variables
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
5 |
481b55fc4b96
added utility to get process env variables
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
6 # must be run as root |
481b55fc4b96
added utility to get process env variables
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
7 if [[ "$(whoami)" != "root" ]] |
481b55fc4b96
added utility to get process env variables
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
8 then |
481b55fc4b96
added utility to get process env variables
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
9 echo "must be run as root" |
481b55fc4b96
added utility to get process env variables
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
10 exit 1 |
481b55fc4b96
added utility to get process env variables
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
11 fi |
481b55fc4b96
added utility to get process env variables
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
12 |
481b55fc4b96
added utility to get process env variables
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
13 # loop over arguments |
481b55fc4b96
added utility to get process env variables
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
14 for PROG in $@ |
481b55fc4b96
added utility to get process env variables
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
15 do |
481b55fc4b96
added utility to get process env variables
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
16 EXIT=0 |
481b55fc4b96
added utility to get process env variables
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
17 if PID=$(pidof -x ${PROG}) |
481b55fc4b96
added utility to get process env variables
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
18 then |
481b55fc4b96
added utility to get process env variables
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
19 echo '='${PROG}: ${PID}'=' |
481b55fc4b96
added utility to get process env variables
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
20 cat /proc/${PID}/environ | tr '\000' '\012' | sort |
481b55fc4b96
added utility to get process env variables
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
21 else |
481b55fc4b96
added utility to get process env variables
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
22 EXIT=1 |
481b55fc4b96
added utility to get process env variables
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
23 echo "" |
481b55fc4b96
added utility to get process env variables
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
24 fi |
481b55fc4b96
added utility to get process env variables
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
25 done |