Last active
September 20, 2018 07:26
-
-
Save kedazo/3ce417be59cd8304142e63dd9c1f6002 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# A command to show the cmon process threads, note any cmon running | |
# inside containers will be skipped. | |
# | |
IFS=' | |
' | |
CMONPIDS=`pgrep cmon` | |
SELECTED='' | |
for APID in ${CMONPIDS}; do | |
if grep cpuset /proc/$APID/cgroup | grep lxc >/dev/null 2>/dev/null; then | |
# skip cmon-s in container | |
continue | |
fi | |
if [ `cat /proc/$APID/comm` != "cmon" ]; then | |
# only match if command name is exactly "cmon" | |
continue | |
fi | |
SELECTED=${APID} | |
break; | |
done | |
if [ "${SELECTED}x" == "x" ]; then | |
echo "No cmon found (NOTE: containers were skipped)." | |
exit 1 | |
fi | |
top -H -p ${SELECTED} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment