John Hansen wrote:
For those that may be interested, here is a script that will delete bulk
users. Modified from the bulk user add script.

John

#!/bin/bash
#
#  BULK USER DELETE FOR QMAIL TOASTER
#
# Modified from the Bulk User Adding script that PakOgah
"[email protected]"
# helped to create with Alex Kisakye "[email protected]".
#
# Change a few variables and you are good to go
#
# Location of the users file
# The users file is in the format of just
# username
USERS_FILE="/your/path/file.txt"
#
# The mail domain to which users are created
MAILDOMAIN="@yourdomain.com"
#
# the vdeluser command
QMAILDEL="/home/vpopmail/bin/vdeluser"
#
#Fun starts here No more variables to change below this line
cat ${USERS_FILE} | \
while read USERNAME do
  echo "deleting user: $USERNAME"
        $QMAILDEL $USERNAME$MAILDOMAIN
done
#


Here's something I'd like to see, and if someone polishes the script up a little to do this, I'll put it in QTP.

qtp-vuser-mass-maint script

Usage: qtp-vuser-mass-maint {-a | -d} [-g] [-t] [-b filename | filename]

Description:
.) either the -a or -d flag (--add or --delete should be accepted) is required, -a for add, -d for delete
.) -g (or --generate) flag generates passwords (add only)
.) -b (or --background) flag indicates to run in background, with no user prompting .) -t (or --test) flag indicates to run through the file and do echoes, but don't actually update anything
.) filename is optional. User is prompted for filename if not supplied.
.) script first checks for valid parameters, if invalid then exit
.) check for file. If it doesn't exist and not silent mode, prompt the user for file until file found or blank filename to exit. .) if not background mode, read first record and echo resulting domain, user, and whether there's a password or not. Ask the user if this is correct and would like to proceed. If not ok, exit. .) if -g flag is specified, use apg program to generate a password for each user. Use a variable for apg parameters so that they can be easily tailored, or pass apg parameters as value of -g flag.
.) echo each user processed with relevant information

Anyone care to tackle this? I'd encourage you to browse through the qtp- scripts to see how you might do various things. The resulting script must released under the GPL, as is most of the QTP content. Note, be prepared for me to refactor the script to my liking before putting it into qtp. Or not, if I like the way it reads. ;)

Any takers? We can move this topic over to the development list if there are.

--
-Eric 'shubes'


---------------------------------------------------------------------------------
Qmailtoaster is sponsored by Vickers Consulting Group 
(www.vickersconsulting.com)
   Vickers Consulting Group offers Qmailtoaster support and installations.
     If you need professional help with your setup, contact them today!
---------------------------------------------------------------------------------
    Please visit qmailtoaster.com for the latest news, updates, and packages.
To unsubscribe, e-mail: [email protected]
    For additional commands, e-mail: [email protected]


Reply via email to