Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Oct 9th, 2010  |  syntax: None  |  size: 1.22 KB  |  views: 406  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #!/bin/bash
  2. # Written by Matteo Predieri - m.predieri_AT_damsistemi_DOT_it
  3. # Written by Riccardo Riva - r.riva_AT_damsistemi_DOT_it
  4. #
  5. # Simple and raw script to create zarafa users and mailboxes from a test file
  6. #
  7. # The full fill-in of the text file is mandatory
  8. # So fill in both "Name" and "Surname" with the following syntax
  9. #
  10. # username    password    email    name    surname
  11. #
  12.  
  13. USERS_LIST=/tmp/userlists.txt
  14. ZARAFA_CMD=/usr/bin/zarafa-admin
  15. LOGFILE=/tmp/zara_user_creation.log
  16.  
  17. echo "Zarafa User Creation Log" > $LOGFILE
  18. what="user";
  19.  
  20. for item in $( cat $USERS_LIST ); do
  21.  
  22.  if [ $what = "user" ]; then
  23.  user=$item;
  24.  what="passwd";
  25.  else
  26.  if [ $what = "passwd" ]; then
  27.  passwd=$item;
  28.  what="email";
  29.  else
  30.  if [ $what = "email" ]; then
  31.  email=$item;
  32.  what="name";
  33.  else
  34.  if [ $what = "name" ]; then
  35.  name=$item;
  36.  what="surname";
  37.  else
  38.  surname=$item;
  39.  
  40.  echo "Result in creating User: $user, with password: $passwd, with email address: $email with Full Name: $name $surname :" >> $LOGFILE
  41.  FULLNAME="'$name $surname'"
  42.  $ZARAFA_CMD -c $user -p $passwd -e $email -f "$FULLNAME" -a0 >> $LOGFILE
  43.  echo -ne  "-------------------------------\n" >> $LOGFILE
  44.  what="user";
  45.  fi
  46.  
  47.  fi
  48.  fi
  49.  
  50.  fi
  51. done