
Untitled
By: a guest on
Oct 9th, 2010 | syntax:
None | size: 1.22 KB | hits: 355 | expires: Never
#!/bin/bash
# Written by Matteo Predieri - m.predieri_AT_damsistemi_DOT_it
# Written by Riccardo Riva - r.riva_AT_damsistemi_DOT_it
#
# Simple and raw script to create zarafa users and mailboxes from a test file
#
# The full fill-in of the text file is mandatory
# So fill in both "Name" and "Surname" with the following syntax
#
# username password email name surname
#
USERS_LIST=/tmp/userlists.txt
ZARAFA_CMD=/usr/bin/zarafa-admin
LOGFILE=/tmp/zara_user_creation.log
echo "Zarafa User Creation Log" > $LOGFILE
what="user";
for item in $( cat $USERS_LIST ); do
if [ $what = "user" ]; then
user=$item;
what="passwd";
else
if [ $what = "passwd" ]; then
passwd=$item;
what="email";
else
if [ $what = "email" ]; then
email=$item;
what="name";
else
if [ $what = "name" ]; then
name=$item;
what="surname";
else
surname=$item;
echo "Result in creating User: $user, with password: $passwd, with email address: $email with Full Name: $name $surname :" >> $LOGFILE
FULLNAME="'$name $surname'"
$ZARAFA_CMD -c $user -p $passwd -e $email -f "$FULLNAME" -a0 >> $LOGFILE
echo -ne "-------------------------------\n" >> $LOGFILE
what="user";
fi
fi
fi
fi
done