All pastes #368352 Raw Edit

Stuff

public text v1 · immutable
#368352 ·published 2007-02-23 00:38 UTC
rendered paste body
# Mail split script - for virtual mail boxes
# 
# Some code 'borrowed' from Dan W's formail script

echo -n "Enter main account username: "
read uname
echo -n "Enter domain name: "
read domain
echo -n "Enter Virtual Mailbox username: "
read vuser
echo -n "Enter File Size (IE 30M, 350K, etc.): "
read fsize

  if [ -z "$uname" ] || [ -z "$domain" ] || [ -z "$vuser" ] || [ -z "$fsize" ]
   then
   echo $0: you didnt enter all the required fields
   exit 1
  fi

  if [ ! -e "/usr/boxes/$uname/$domain/$vuser" ]
   then
    echo $0: /usr/boxes/$uname/$domain/$vuser does not exist
    exit 1
  fi

echo "Moving mail for $vuser@$domain"
echo " "
/bin/mv /usr/boxes/$uname/$domain/$vuser /usr/boxes/$uname/$domain/$vuser^/.imap/$vuser
echo "Splitting mailbox into $fsize chunks"
echo " "
/usr/local/bin/mail_split /usr/boxes/$uname/$domain/$vuser^/.imap/$vuser -s $fsize
echo "Removing moved Inbox file"
echo " "
/bin/rm /usr/boxes/$uname/$domain/$vuser^/.imap/$vuser
echo "Adding split files to .mailboxlist"
echo " "
cd /usr/boxes/$uname/$domain/$vuser^/.imap/
/bin/ls $vuser.* >> /usr/boxes/$uname/$domain/$vuser^/.imap/.mailboxlist
echo "Complete"
exit 0