0

cPanel Helpful Scripts

I put these together to assist in various issues and tasks on cPanel servers.  Some of these may delete data, I am not responsible for any lost data, these are provided mainly as a reference for myself.

Contents

Domlogs

Find top 10 accessed pages in each domlog

for i in `find /usr/local/apache/domlogs/*/* -type f -not -name ftp.* -not -name *-bytes_log.* -not -name "*log*"`; do echo "Top access in $i"; awk '{print $7}' $i|cut -d? -f1|sort|uniq -c|sort -nk1|tail -n10; echo ""; done

Find top 10 domlogs of today

grep -c `date +%d`/`date +%b`/`date +%Y` /usr/local/apache/domlogs/*|grep :..|sort -t: -nr -k 2|head

Email Spam

Delete all messages in Exim’s queue over $mtime days old

for id in `\ls /var/spool/exim/input/`; do find /var/spool/exim/input/$id -type f -mtime +$mtime -exec rm -f {} \; ; done

Find directories of scripts sending email

grep cwd=\/home\/ /var/log/exim_mainlog| cut -d' ' -f4 | sort | uniq -c | sort -n

Find users with email in the mail queue

find /var/spool/exim/input/ -name '*-H' | xargs grep 'auth_id' | awk '{print $2}' | sort|uniq -c

Add email addresses in bulk

for email in `cat /home/temp/listofaddresses.txt`; do `/scripts/addpop $email PASSWORD QUOTA_IN_MB`; done

tfmm

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.