Daily clamscan

Script that scans every public_html in the server using clamav and sends the results by email.

#!/bin/bash
SUBJECT=”VIRUS at `hostname`!!!”
EMAIL=”mail@mail.com”
LOG=/tmp/clam_scan.log
rm -f ${LOG};
check_scan () {
if [ `cat ${LOG} | grep FOUND | grep -v 0 | wc -l` != 0 ]
then
EMAILMESSAGE=`mktemp /tmp/virus-alert.XXXXX`
echo “`cat ${LOG}`” >> ${EMAILMESSAGE}
mail -s “${SUBJECT}” “${EMAIL}” < ${EMAILMESSAGE}
fi
}
clamscan -ri /home/*/public_html/ –log=${LOG} > /dev/null
check_scan

Vzuptime for Openvz

Vzuptime is a basic bash script that will output a list with the load average of each container running in the local openvz instance.

#!/bin/bash
hostname;
uptime;
echo “————–“;
for f in `vzlist | awk -F ‘ ‘ ‘{print $1}’ | tail -n +2`
do
echo -n -e “${f} -\t”;vzctl exec $f uptime | awk -F ‘load average:’ ‘{ print $2 }’
done
echo “————–“;

 

Vzuptime v1.0