Thursday, February 7, 2013

bulk add users to moira lists

I always forget how to do this, but if you ever need to populate an email list at MIT, you can do it through blanche.

http://kb.mit.edu/confluence/pages/viewpage.action?pageId=3907064
If you want to add a long list of names to a list, you can put them all in a text file and do 'blanche listname -al filename', or if you want a list to contain only the names in a text file, you can type 'blanche listname -f filename' and the appropriate members will be both added and removed
Thus, at a terminal, I would go

narw@ubuntu:~$ ssh nouyang@linux.mit.edu [remote login to athena]
nouyang@dr-wily:~$ vi 2.007ua [make a file with a list of athena usernames. it will accept the @mit.edu but it's happier without. You can do this with gedit if you want.]
nouyang@dr-wily:~$ blanche 2.007-2013uas -al 2.007ua

voila! done. If you want to double-check they've been added, just do

nouyang@dr-wily:~$ blanche 2.007-2013uas

and everyone should pop up. or check online at https://groups.mit.edu/webmoira/

yay!

Additionally, if you're copy-pasting a lot of stuff (e.g. from stellar) and only want the lines containing emails, you can do
http://lglinux.blogspot.com/2009/08/vim-keep-or-delete-lines-matching.html
:v/@/d
and that keeps only the lines with @ signs. Blanche doesn't much care about whitespace so don't worry about it.

e.g.
Nancy Ouyang
    nouyang@blah.edu
    Office: EAST CAMPUS # H208 
    Phone: 2256223  


gets reduced to

    nouyang@mit.edu

and blanche -al just says

Warning: "nouyang@mit.edu" converted to "nouyang" because it is a local name.

and works perfectly fine.

No comments:

Post a Comment