This just makes live easier importing databases into cPanel and saves me time. This will create the database using cPanel’s uapi, create database user and password, assign all privelages and then import the database from the file to the newly created database.
Usage: Upload a database to the home directory, run above as cPanel user and replace “filename.sql” with the filename of the database, and dbsuffix with the suffix you want the database to be created on.
Made to provide breakdowns to customers, Shows the top 10 directories that are using the most amount of files/inodes and prints a total for the account.
All you need to do is run in your terminal ip 1.1.1.1 (of course replacing 1.1.1.1 with the IP you would like to lookup) and it’ll print out some nice info
Tails the domlogs of the server over 30 seconds and collects the IP addresses that make requests, sorts by number of hits and displays them with request urls and user agents
#! /bin/bash# The function to scan all the access logs and record what they are doingfunction traffictrap { find /etc/apache2/logs/domlogs/ -maxdepth 1 -type f -mmin -2 | egrep -v 'ftp_log|bytes_log' | xargs tail -qfn0 | grep -v "==>" > /tmp/trafficlog.txt}# Export the function and then kill it after 30 secondsif [ $# -eq 0 ]; then # If we have arguments, probably a fleet wide command, remove the echos echo "Collecting data for 30 seconds, please wait..."fiexport -f traffictraptimeout 30s bash -c traffictrapif [ $# -eq 0 ]; then # FIND COMMON BOTS echo "Most common bots found:" grep -io "\w*bot\w*" /tmp/trafficlog.txt | sort | uniq -c | sort -n echo ------------------------------------------------------------ echo ------------------------------------------------------------ # FIND COMMON IP'S echo "Most requests per IPs found:" cat /tmp/trafficlog.txt | awk '{print $1}' | sort -n | uniq -c| sort -n | tail -15 echo ------------------------------------------------------------ echo ------------------------------------------------------------ # FIND COMMON HITS echo "Most common requested IPs" cat /tmp/trafficlog.txt | grep -oP '(?<=] ").*(?="\s\d)' | sort | uniq -c | sort -n | tail -15 echo ------------------------------------------------------------ echo ------------------------------------------------------------ echo "If you are suspicous of an IP, run the following command entering part of all of the IP at the end" echo "find /etc/apache2/logs/domlogs/ -maxdepth 1 -type f -mmin -2 | egrep -v 'ftp_log|bytes_log' | xargs tail -qfn0 | grep -v '==>' | grep"elif [[ $1 == "bot" ]]; then echo $(hostname -s) " - " $(grep -io "\w*bot\w*" /tmp/trafficlog.txt | sort | uniq -c | sort)fi