Server IP : 104.244.120.118  /  Your IP : 216.73.216.198
Web Server : Apache
System : Linux ded5817.inmotionhosting.com 5.14.0-741.22.1.el9_9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Nov 12 14:34:46 UTC 2026 x86_64
User : persoanlinjuryla ( 1006)
PHP Version : 8.5.13
Disable Function : exec,passthru,shell_exec,system
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF
Directory (0555) :  /../../opt/dedrads/python/../python/../python/../python/../python/../python/../mysql/../

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : //../../opt/dedrads/python/../python/../python/../python/../python/../python/../mysql/../procscrape
#!/usr/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;