Disk space usage is always a problem for the server admins and this script can be used for removing the old account backups from the server. The first script will make a list for the accounts to be removed and the second one will clean it.
for i in `ll /backup/cpbackup/weekly/ |awk {‘print $9′}|grep -v ^$|grep -Ev “cpbackupstatus|dirs|files”|cut -d’/’ -f1` ; do grep -w $i /etc/userdomains >/dev/null ; if [ $? -ne 0 ] ; then echo $i ; fi ; done | grep -v “.tar.gz” > /root/deletelistnw
for i in `cat /root/deletelistnw`; do rm -rf /backup/cpbackup/weekly/$i; done
Comments
Post a Comment