Mini Shell

Direktori : /opt/sharedrads/oldrads/crons/
Upload File :
Current File : //opt/sharedrads/oldrads/crons/logcheck.sh

#!/bin/bash

if [ -f /etc/cpanel/ea4/is_ea4 ]; then
    LOGPATHS="/var/lib/mysql/ /var/log/ /var/log/apache2/ /var/log/apache2/domlogs/"
else
    LOGPATHS="/var/lib/mysql/ /var/log/ /usr/local/apache/logs/ /usr/local/apache/domlogs/"
fi
TEMPLOG=/var/log/logfilesizecheck.${RANDOM}
for LOGPATH in $LOGPATHS; do
	find $LOGPATH -maxdepth 1 -type f | xargs ls -al |sed '/ibdata/d'| awk -v alog="$TEMPLOG" '{ if($5 > 1825361100) print > alog;}'
done

if [ -f $TEMPLOG  ];then
	subject="large_log_files_detected"
	cat $TEMPLOG
	mail -s $subject sadmin-ra2@imhadmin.net< $TEMPLOG
	rm -rf $TEMPLOG
fi

Zerion Mini Shell 1.0