Daily clamscan

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

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


LVM Block device filter with multipathd and lvm

If you use a multipathd & lvm setup with a ACTIVE-PASSIVE redundant SAN (ex: EMC VNX) and if you use both SPs (storage processors) in the multipathd for additional redundancy you will get I/O errors in some block devices.

This happens because LUNs will only be announced by the passive SP in case of failure, this provokes I/O errors if you run a pvscan or vgscan since theres no LUNs being announced in the passive SP block devices.

Adding a filter in /etc/lvm/lvm.conf like this: filter = [ “r/disk/”, “r/sd.*/”, “a/.*/” ]

Using this filter lvm will not use sd* block devices, using only mpath* devices which are the ones you want, removing the I/O errors from the logs.

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.

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


Vzuptime v1.0