PNG  IHDR;IDATxܻn0K )(pA 7LeG{ §㻢|ذaÆ 6lذaÆ 6lذaÆ 6lom$^yذag5bÆ 6lذaÆ 6lذa{ 6lذaÆ `}HFkm,mӪôô! x|'ܢ˟;E:9&ᶒ}{v]n&6 h_tڠ͵-ҫZ;Z$.Pkž)!o>}leQfJTu іچ\X=8Rن4`Vwl>nG^is"ms$ui?wbs[m6K4O.4%/bC%t Mז -lG6mrz2s%9s@-k9=)kB5\+͂Zsٲ Rn~GRC wIcIn7jJhۛNCS|j08yiHKֶۛkɈ+;SzL/F*\Ԕ#"5m2[S=gnaPeғL lذaÆ 6l^ḵaÆ 6lذaÆ 6lذa; _ذaÆ 6lذaÆ 6lذaÆ RIENDB` #!/bin/bash if [[ $1 == "" ]] ; then echo "=-=-=-=-=-=-=-=-=-=-=-=-=-=-" echo "Possible options are:" echo "--------------------" echo -e "\e[35m\e[1m--------IP Part--------\e[0m" echo -e "\e[32mstat\e[0m" - it show stat for type of connection state echo -e "\e[31mexample: 911 stat\e[0m" echo -e "\e[33m----------\e[0m" echo -e "\e[32m80 \e[0m"- count only connection that are in apache echo -e "\e[31mexample: 911 80\e[0m" echo -e "\e[33m----------\e[0m" echo -e "\e[32mcount\e[0m" - count all connection made by ip echo -e "\e[31mexample: 911 count\e[0m" echo -e "\e[33m----------\e[0m" echo -e "\e[35m\e[1m--------Mail Part--------\e[0m" echo -e "\e[32mmail\e[0m" show stat for mailq by senders echo -e "\e[31mexample: 911 mail\e[0m" echo -e "\e[33m----------\e[0m" echo -e "\e[32mmailrm \e[0m"- remove all frozem msg echo -e "\e[31mexample: 911 mailrm\e[0m" echo -e "\e[33m----------\e[0m" echo -e "\e[32mmailf \e[0m"- find user in exim log files echo -e "\e[31mexample: 911 mailf user@host.com\e[0m" echo -e "\e[33m----------\e[0m" echo -e "\e[32mmaildel\e[0m" - delete all that match regex echo -e "\e[31mexample: 911 maildel \"(ifpesnet|weedgrow|abddadac)\" \e[0m" echo -e "\e[35m\e[1m--------User Part--------\e[0m" echo -e "\e[32mdomu X\e[0m" - show domain stat for X days echo -e "\e[31mexample: 911 domu trinotortosa.com 5\e[0m" echo -e "\e[33m----------\e[0m" echo -e "\e[32museru \e[0m" - show current usage per user echo -e "\e[31mexample: 911 useru timhuntm\e[0m" echo -e "\e[34m\e[1m--------Mass Part--------\e[0m" echo -e "\e[32mtopload \e[0m" - show top XX ot most load average cause users echo -e "\e[31mexample: 911 topload 20 or any number\e[0m" echo -e "\e[33m----------\e[0m" echo -e "\e[34m\e[1m--------EXPERIMENTAL--------\e[0m" echo -e "\e[32mchart \e[0m" - send graphs with user usage to mail echo -e "\e[31mexample: 911 chart USERNAME pavlin@thmdhosting.net \e[0m" echo -e "\e[33m----------\e[0m" echo "Have a nice work" echo "" fi #this part count netstat connection types if [[ $1 == "stat" ]] ; then netstat -lapten | awk '{print $6}' | sort | uniq -c | sort -n echo "" echo "This script doest this" echo "netstat -lapten | awk '{print $6}' | sort | uniq -c | sort -n" echo "" fi #count and show all that use port 80 if [[ $1 == "80" ]] ; then netstat -antu | grep :80 echo "" echo "This script doest this" echo "netstat -antu | grep :80" echo "" fi #count all used connection by ip if [[ $1 == "count" ]] ; then netstat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n echo "" echo "This script doest this" echo "netstat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n" echo "" fi #find who make mailq if [[ $1 == "mail" ]] ; then exim -bp | grep "<**..**>" | awk '{print $4}' | sed -e 's/[<>]//g' | sort | uniq -c | sort -n | tail echo "" echo "This script doest this" echo "exim -bp | grep \"<**..**>\" | awk '{print $4}' | sed -e 's/[<>]//g' | sort | uniq -c | sort -n | tail" echo "" fi #remove all frozen mesages if [[ $1 == "mailrm" ]] ; then exim -bp | grep "<>" | awk '{print $3}' | xargs -i exim -Mrm {} echo "" echo "=====================This script does this=====================" echo "exim -bp | grep "<>" | awk '{print $3}' | xargs -i exim -Mrm {}" echo "" fi #search for string in exim log if [[ $1 == "mailf" ]] ; then grep "$2" /var/log/exim_mainlog | grep -i html | tail echo "" echo "=====================This script does this=====================" echo "grep \"$2\" /var/log/exim_mainlog | grep -i html | tail " echo "" fi #delete mail/s from exim mailq by string if [[ $1 == "maildel" ]] ; then exim -bp | egrep $2 | awk '{print $3}' | xargs -i exim -Mrm {} echo "" echo "=====================This script does this=====================" echo "exim -bp | egrep $2 | awk '{print $3}' | xargs -i exim -Mrm {}" echo "" fi #show stat for CPU usage by doman names for X days if [[ $1 == "domu" ]] ; then domain="$2"; for i in `seq 1 $3 `; do let i=$i+1 ; let k=$i-1 ; let s="$(date +%s) - (k-1)*86400"; let t="$(date +%s) - (k-2)*86400"; echo `date -Idate -d @$s`; /usr/local/cpanel/bin/dcpumonview `date -d @$s +%s` `date -d @$t +%s` | sed -r -e 's@^(.*)(.*)(.*)(.*)(.*)$@Account: \1\tDomain: \2\tCPU: \3\tMem: \4\tMySQL: \5@' -e 's@^Top Process(.*)(.*)$@\1 - \2@' | grep $domain -A3 ; done echo "" echo "=====================This script does this=====================" echo "Too hard to explain :) Please check source code" echo "" fi #show cpu usage for user if [[ $1 == "useru" ]] ; then /usr/local/cpanel/bin/dcpumonview | sed -e 's/<[^>]*>/ /g' | grep $2 echo "" echo "=====================This script does this=====================" echo "/usr/local/cpanel/bin/dcpumonview | sed -e 's/<[^>]*>/ /g' | grep $2" echo "" fi #show top 20 of most CPU usage user. if [[ $1 == "topload" ]] ; then /usr/local/cpanel/bin/dcpumonview |grep "%" | grep "home" | sed -e 's/<[^>]*>/ /g' | awk '{print $4"%",$6,$7}' | sort -n | tail -n$2 echo "" echo "=====================This script does this=====================" echo "/usr/local/cpanel/bin/dcpumonview |grep "%" | grep "home" | sed -e 's/<[^>]*>/ /g' | awk '{print $4"%",$6,$7}' | sort -n | tail -n$2 " echo "" fi #show png generatet stat for current user for past 7 days if [[ $1 == "chart" ]] ; then lvechart --user=$2 --period=7d --output=/tmp/$2.png echo -e "This user $2 is on $HOSTNAME hase ovelimit please check it" | mail -s 'statistic for last 7 days ' -a /tmp/$2.png $3 echo "" echo "=====================This script does this=====================" echo "lvechart --user=$2 --period=7d --output=/tmp/$2.png" echo "" fi