A script to not run back ups on websites over 10 gigs in cpanel

To avoid sites too big from being back upped, just run this script in a weekly cron from root.

#!/bin/bash

max_size=”2097152″ # This is 2097152KB or 2GB

for u in `ls /var/cpanel/users/`;
do
size=$(repquota -a | grep ${u}|awk ‘{print $3}’|sort -k 1 -nr|head -1);
if [ “${size}” -ge “${max_size}” ];
then
echo “${u}” >> /tmp/cpbackup-userskip.conf;
fi;
done;

sort -u /tmp/cpbackup-userskip.conf /etc/cpbackup-userskip.conf > /tmp/cpbackup-userskip.conf.uniq;
cp -f /tmp/cpbackup-userskip.conf.uniq /etc/cpbackup-userskip.conf;
rm -f /tmp/cpbackup-userskip.conf.*;