daily pastebin goal
29%
SHARE
TWEET

Untitled

a guest May 16th, 2018 86 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Ryan Packard Aliases
  2. #!/bin/sh
  3. #
  4. # What needs to be added?
  5. #-------------------------------------#
  6. # More shit
  7. #
  8. #-------------------------------------#
  9. #
  10.  
  11. #PS1
  12. export PS1='\[\e[1;32m\]\u\[\e[1;37m\]@\[\e[0;37m\]\H\[\e[0;36m\]:\w\[\e[0;0m\] \$ ' ;
  13.  
  14. #Aliases
  15. alias mv="mv -v" ;
  16. alias cp="cp -v" ;
  17. alias rm="rm -v" ;
  18. alias ln="ln -v" ;
  19. alias ll="ls -lah" ;
  20. alias yes="no" ;
  21. alias chmod="chmod -v" ;
  22. alias chown="chown -v" ;
  23. #alias curl="curl -viLS#" ;
  24.  
  25. alias excel="echo https://docs.google.com/spreadsheets/d/10xTXyzbeq4MfUHI4TAu0EAPaFFwAShXmEyb4y6Iwuy8/edit#gid=0;" ;
  26. alias dcpumonview='/usr/local/cpanel/bin/dcpumonview' ;
  27. alias cpanelsession="bash <(curl -ks https://codex.hostdime.com/scripts/download/cpanel_session)" ;
  28. alias srvinfo="bash <(curl -ks https://codesilo.dimenoc.com/grahaml/server-check/raw/master/server_check);" ;
  29. alias realmem="bash <(curl -ks https://codex.hostdime.com/scripts/download/realsarmemawk)" ;
  30. alias apachetune="bash <(curl -ks https://codex.hostdime.com/scripts/download/apachememtune)" ;
  31. alias axon="bash <(curl -ks https://codex.hostdime.com/scripts/download/simpleaxonparser)" ;
  32. alias sarmerge="bash <(curl -ks https://codesilo.dimenoc.com/spenserc/sarlogmerge/raw/master/sarmerge.sh)" ;
  33. alias drivehealth="bash <(curl -ks https://codex.hostdime.com/scripts/download/CheckDriveHealth)" ;
  34. alias backupscanner="bash <(curl -ks https://codex.hostdime.com/scripts/download/backupscanner)" ;
  35. alias tailapache="tail -f /etc/httpd/logs/error_log" ;
  36. alias tailmysql="tail -f /var/lib/mysql/$(hostname).err" ;
  37. alias lynxdump="/usr/bin/lynx -dump -width $COLUMNS http://127.0.0.1/whm-server-status" ;
  38. alias logtrimmer="bash <(curl -ks https://codex.hostdime.com/scripts/download/logfiletrim)" ;
  39. alias mysqltuner="perl <(curl -k -L http://raw.github.com/rackerhacker/MySQLTuner-perl/master/mysqltuner.pl)" ;
  40. alias ncduinstall="bash <(curl -ks https://codex.hostdime.com/scripts/download/ncdu_install)" ;
  41. alias top5domains="bash <(curl -ks https://codex.hostdime.com/scripts/download/topfivedomains)" ;
  42. alias duanal="bash <(curl -ks https://codex.hostdime.com/scripts/download/diskusage)" ;
  43.  
  44. #Hardware Information Section
  45. alias raminfo="dmidecode -t memory | grep -i size; dmidecode -t memory | grep -i speed" ;
  46. #alias driveinfo="bash <(curl -ks https://codex.hostdime.com/scripts/download/CheckDriveHealth); hwinfo --block --short; lsblk -io KNAME,TYPE,SIZE,MODEL" ;
  47. #driveinfo function is below
  48. #cpuinfo function below
  49.  
  50. #Servers
  51. alias vps.gohemis.com="ssh 64.37.49.241 -p1891 -lroot" ;
  52. alias sand="ssh 198.49.73.231 -p1291 -lroot;" ;
  53. alias tunnel="ssh 159.89.235.172 -p22 -lroot" ;
  54.  
  55. #Functions
  56. function ssh()
  57. {
  58.         screen -t "$*" -- /usr/bin/ssh -l root -p 1291 $*
  59. }
  60.  
  61. function dog()
  62. {
  63.     dig any +nocomments +nostats +nottl $1 | grep "IN" | grep -v "ANY" | grep -E "[AMXCNESRVOT]{1}" | sort
  64. }
  65.  
  66. function cpuinfo()
  67. {
  68.     CLK_ACT="$(dmidecode -t processor | grep "Current Speed" | sed -e 's/^[ \t]*//')"
  69.     CLK_MAX="$(dmidecode -t processor | grep "Max Speed" | sed -e 's/^[ \t]*//')"
  70.     echo "- CPU Information:"
  71.     echo -e "\`\`\`"
  72.     echo -e "Clock Speeds: ${CLK_ACT} - ${CLK_MAX}"
  73.     dmidecode -t processor | grep Version | sed -e 's/^[ \t]*//' ;
  74.     echo -e "\`\`\`"
  75.     echo -e "- Core Temperatures:"
  76.     echo -e "\`\`\`"
  77.     echo "CPU      Actual  High   Critical"
  78.     sensors | grep "Core" | awk '{ print $1,$2,$3,$6,$9 }' | tr -d ')' ;
  79.     echo "\`\`\`"
  80. }
  81.  
  82. function apacheinfo()
  83. {
  84. grep -iE "worker|limit" /etc/httpd/conf/httpd.conf
  85. #add more here
  86. }
  87.  
  88. function dusort()
  89. {
  90.     FILE='/root/$(date +%s)-unsorted-du.tmp'
  91.     du -h --max-depth=1 $1 > "$FILE" ;
  92.     cat "$FILE" | awk '$1 ~ /T/' | sort -nrk1 ;
  93.     cat "$FILE" | awk '$1 ~ /G/' | sort -nrk1 ;
  94.     cat "$FILE" | awk '$1 ~ /M/' | sort -nrk1 ;
  95.     cat "$FILE" | awk '$1 ~ /K/' | sort -nrk1 ;
  96.     cat "$FILE" | awk '$1 ~ /[0-9]$/' | sort -nrk1 ;
  97.     \rm -f "$FILE" ;
  98. }
  99.  
  100. function tophttpd()
  101. {
  102.     netstat -pltuna | grep httpd | awk '{ print $5 }' | cut -d':' -f1 | grep -v '0.0.0.0' | grep -v ':::' | sort -nk1 | uniq -c$ ;
  103.    
  104.     #Adding more soon
  105. }
  106.  
  107. function phpinfo()
  108. {
  109.     echo -e "<?php phpinfo(); ?>" > phpinfo.php ;
  110.     chown $(stat -c %U .): phpinfo.php ;
  111. }
  112.  
  113. function domaininfo()
  114. {
  115.     if [ -z "$1" ]; then
  116.         echo "View the 7-Day Usage Report for a domain."
  117.         echo "Usage: 7day domain.com"
  118.         return
  119.     fi
  120.  
  121.     for i in `seq 1 7 `;
  122.     do let i=$i+1 ;
  123.     let k=$i-1 ;
  124.     let s="$(date +%s) - (k-1)*86400";
  125.     let t="$(date +%s) - (k-2)*86400";
  126.     echo `date -Idate -d "1970-01-01 $s sec"`;
  127.     /usr/local/cpanel/bin/dcpumonview `date -d "1970-01-01 $s sec" +%s` `date -d "1970-01-01 $t sec" +%s` | sed -r -e 's@^<tr bgcolor=#[[:xdigit:]]+><td>(.*)</td><td>(.*)</td><td>(.*)</td><td>(.*)</td><td>(.*)</td></tr>$@Account: \1\tDomain: \2\tCPU: \3\tMem: \4\tMySQL: \5@' -e 's@^<tr><td>Top Process</td><td>(.*)</td><td colspan=3>(.*)</td></tr>$@\1 - \2@' | grep "Domain: $2" -A3 ;
  128.     done }; for i in `seq 1 20 `; do alias "$i"'day'='dcp '"$i" ; done
  129.    
  130. function iplocation()
  131. {
  132.     if [ -z "$1" ]; then
  133.         echo "Pull geolocation data for an IP from ipinfo.io"
  134.         echo "Usage: geoip IP"
  135.         return
  136.     fi
  137.  
  138. LOOKUPURL="$1";
  139. curl -s "ipinfo.io/${LOOKUPURL}" | tr -dc '[a-zA-Z0-9 \n:.]';
  140. printf "\n";
  141. }
  142.  
  143. function kcareinstall()
  144. {
  145.     printf "KernelCare installation KB:\n https://kb.hostdime.com/display/HDUSKB/Installing+KernelCare+with+an+IP-Based+License \n\n";
  146.  
  147.     if
  148.         [ $(curl -s https://raw.githubusercontent.com/iseletsk/kernelchecker/master/py/kc-compat.py | python) = "COMPATIBLE" ];
  149.        
  150.     then
  151.         printf "Kernel version is supported. Proceeding with KernelCare download and installation.\n\n";
  152.         curl -s https://repo.cloudlinux.com/kernelcare/kernelcare_install.sh | bash;
  153.         kcarectl --set-patch-type extra --update;
  154.         sysctl -w fs.enforce_symlinksifowner=1;
  155.         sysctl -w fs.symlinkown_gid=99;
  156.         touch /etc/sysconfig/kcare/sysctl.conf;
  157.         printf "fs.enforce_symlinksifowner=1\nfs.symlinkown_gid=99" > /etc/sysconfig/kcare/sysctl.conf;
  158.         kcarectl --info;
  159.         kcarectl --update;
  160.        
  161.     else
  162.         printf "Kernel version is not supported. Please assure this kernel version is supported by KernelCare prior to proceeding:\n http://patches.kernelcare.com/ \n";
  163.        
  164.     fi
  165. }
  166.  
  167.  
  168. #function rpdnsupdate() -------- Not in production. Saving for notation
  169. #{
  170. #
  171. #
  172. #   -----Below line is not apart of the script, but can be put in. Can also just add this to the while loop.
  173. #   \ls -1 /var/named/ | grep ".db" | grep -v ".temp" > /home/.hd/xfer/2021434/domains.list
  174. #  
  175. #   echo -n "Enter the SOURCE server IP : "
  176. #   read f
  177. #
  178. #   echo -n "Enter the DESTINATION server IP : "
  179. #   read t
  180. #
  181. #   cat /home/.hd/xfer/2021434/domains.list | while read i; do replace $f $t -- /var/named/$i
  182. #
  183. #   done
  184. #
  185. #   rndc flush
  186. #   rndc reload
  187. #
  188. #
  189. #}
  190.  
  191. echo "
  192.        
  193.                          (  ) (@@) ( )  (@)  ()    @@  aLiAs LoAdEd ChOo ChOo
  194.                      (@@@)
  195.                  (    )
  196.               (@@@@)
  197.  
  198.             (   )
  199.         ====        ________                ___________
  200.     _D _|  |_______/        \__I_I_____===__|_________|
  201.      |(_)---  |   H\________/ |   |        =|___ ___|      _________________
  202.      /     |  |   H  |  |     |   |         ||_| |_||     _|                \___
  203.     |      |  |   H  |__--------------------| [___] |   =|          |
  204.     | ________|___H__/__|_____/[][]~\_______|       |   -|          |
  205.     |/ |   |-----------I_____I [][] []  D   |=======|____|______________________|
  206.   __/ =| o |=-~~\  /~~\  /~~\  /~~\ ____Y___________|__|________________________|
  207.    |/-=|___|=O=====O=====O=====O   |_____/~\___/          |_D__D__D_|  |_D__D__D_|
  208.     \_/      \__/  \__/  \__/  \__/      \_/               \_/   \_/    \_/   \_/
  209.    
  210.     " ;
RAW Paste Data
Top