PK œqhYî¶J‚ßFßF)nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/ $#$#$#

Dir : /proc/self/root/opt/sharedrads/
Server: Linux ngx353.inmotionhosting.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64
IP: 209.182.202.254
Choose File :

Url:
Dir : //proc/self/root/opt/sharedrads/procscrape

#!/bin/sh
#Process Scrape
#written by Brad Markle, thrown in a file by Tyler
# Tyler modified the script to pull only user data.

#todo
#* add a yes/no+trap to ask about saving/deleting the log on exit
#* now scrapes user processes before cutting only php

#original
#watch -n .1 "uptime;echo;top -b -c -n 1|head -13|tail -6|grep php >> top.log;echo \"Longest running php proccess:\";cat top.log|sort -k 11|tail -10;echo \" \";echo \"Highes CPU using php processes\";cat top.log|sort -nk 9|tail -10;"

TEMPLOG="top.log.${RANDOM}.${RANDOM}"
# awk '\$2 \\~ /[a-z]+[0-9]/{print}' - this doesn't work in watch due to shell quoting, would be nice tho.
#grep php >> $TEMPLOG;
function scrape () {

if  ! grep " 5" /etc/redhat-release;then
rm -f top.log;watch -n .1 "uptime;echo;top -b -c -n 1|head -13|tail -6|grep php >> top.log;echo \"Longest running php proccess:\";cat top.log|sort -k 11|tail -10;echo \" \";echo \"Highes CPU using php processes\";cat top.log|sort -nk 9|tail -10;"
rm top.log
else
	watch -n .1 "uptime; top -b -c -n 1|grep php  >>$TEMPLOG;echo \"===Longest running php proccess===\";echo \"  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND\"; sort -rk 11 $TEMPLOG|head -13;	echo;echo \"===PHP Processes - Using High CPU===\";echo \"  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND\"; sort -rnk 9 $TEMPLOG|head -13;echo;echo \"===PHP Processes - High Memory===\";echo \"  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND\";sort -rnk 10 $TEMPLOG|head -13;"
fi

}
if [ $# -gt 0 ];
then
	case $1 in
	--help)
		echo "$0 - running processscrape.sh by itself will scrape top for active php processes "
		echo "and generate a list of the longest running and those using the most CPU time."
		;;
	*)
		echo "This program doesn't really take options right now."
	;;
	esac
fi

scrape


rm -f $TEMPLOG;