#!/bin/sh # Written by NONO. http://www.asahi-net.or.jp/~aa4t-nngk/ # PATH=/var/qmail/bin:/usr/local/bin:$PATH # Change this for your environment! POPUDIR=/home/popusers # ASSG=/var/qmail/users/assign ASSGTMP=/var/qmail/users/assign.new POPPW=/etc/poppasswd POPPWTMP=/etc/poppasswd.new read -p "User Name: " POPUNAME if [ ! -e $POPUDIR/$POPUNAME ]; then echo "User $POPUNAME does NOT exist. Nothing Done" exit 1 fi read -p "Do you really want to remove $POPUNAME ?(y/n): " RMCFM if [ "$RMCFM" != "y" ]; then echo "Nothing Done." exit 1 fi cd $POPUDIR rm -rf $POPUNAME [ -e $ASSGTMP ] && rm -f $ASSGTMP sed "/$POPUNAME/d" $ASSG > $ASSGTMP mv -f $ASSGTMP $ASSG sed "/$POPUNAME/d" $POPPW > $POPPWTMP mv -f $POPPWTMP $POPPW qmail-newu echo "[SUCCESS] Mail User $POPUNAME removed." exit 0