On Monday 29 December 2003 16:06, Tom Tu wrote:
> Does anyone have a script that will add or delete email accounts in
> vpopmail given a static file with the email address of each user we want to
> add or delete?
Written for the first time at this e-mail, I've never run this before:
--- cut here ---
#!/bin/bash
if [ "$1" == "" ]; then
echo -n "Filename: "
read FILE
else
FILE=$1
fi
for LINE in `cat $FILE`; do
PROC=`echo $LINE | cut -d: -f1`
EMAIL=`echo $LINE | cut -d: -f2`
PASS=`echo $LINE | cut -d: -f3`
if [ "$PROC" == "ADD" ]; then
vadduser $EMAIL $PASS
elif [ $PROC == "DEL" ]; then
vdeluser $EMAIL
fi
echo "$EMAIL done"
done
--- cut here ---
File input format:
<ADD|DEL>:<EMAIL>:<PASSWORD>
Each account should be written on an empty line.
You can select this file as a parameter at the command line or wait for the
script asks you. ;)
[[]]'s Eduardo M. Bragatto
PS: any corrections in case of errors are welcome.