view bin/procenv.sh @ 709:c24a1b531b7e

move isrunning to a shell script and kill killbyname since there is pkill nowadays
author Jeff Hammel <k0scist@gmail.com>
date Fri, 05 Sep 2014 14:55:11 -0700
parents 481b55fc4b96
children
line wrap: on
line source

#!/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