#!/bin/sh # Gzip and move the biggest 3 mailboxes in /var/mail cd /var/mail du -sh * | perl -ne 'if(/\dG/){print}' | sort -rn | head > /tmp/mail.tmp du -sh * | perl -ne 'if(/\dM/){print}' | sort -rn | head >> /tmp/mail.tmp echo "These are the guys we're moving:" head -3 /tmp/mail.tmp echo head -3 /tmp/mail.tmp | awk '{print $2}' > /tmp/mail.tmp for i in `cat /tmp/mail.tmp` do gzip -c $i > /usr/home/$i/mbox.`date "+%Y%m%d"`.gz rm $i done rm /tmp/mail.tmp