create-domain.pl from txt file

5 posts / 0 new
Last post
#1 Sun, 11/25/2007 - 11:46
sebastianmorsony

create-domain.pl from txt file

Hi

I've been playing around with create-domain.pl and it works fine. Now I would like to read a comma separated file and use this to create my domains.

The domain.txt file could look something like this.

Username,fullname skm,Sebastian Kim Morsony jd,John Doe

I would then like to create a bash script, that runs through this file and executes create-domain.pl with username,fullname for username and description for each line of the file.

Anybody done something like this before?

Best Regards Sebastian Kim Morsony

Sun, 11/25/2007 - 12:29
Joe
Joe's picture

There is already a batch creation mode in the GUI. Open the "Add servers" menu and click "Create From Batch File". Click "Help.." for a complete description of the file format (it's colon-delimited, much like a passwd file, but would be easy to generate from a CSV file, if you know how to use sed or a perl one-liner for substitution).

--

Check out the forum guidelines!

Sun, 11/25/2007 - 21:54
sebastianmorsony

Hi

I would like to schedule the creation of virutal servers. Can this be done with batch creation?

Best Regards
Sebastian

Sun, 11/25/2007 - 22:56 (Reply to #3)
Joe
Joe's picture

That's the weirdest idea I've heard all day. Whatever for?

The answer, of course, is no (since I simply can't imagine a use case for such a capability). You'll need to wrap up your own script to do that. You could either use a shell script or borrow liberally from create-domain.pl and write something in Perl. I suspect the Perl solution would be most effective, if this isn't a one-off thing. Then run it from cron to achieve the scheduling.

--

Check out the forum guidelines!

Mon, 11/26/2007 - 01:34
sebastianmorsony

Hi Joe

Thanks for you answer, but it's really not that weird.

I work at a school where we have around 5000 full time students per year. I would like to setup each user automatically with a virtual server, by using an csv file exportet, from out student database each night. The same goes for disabling/deleting.

This way I could provide all students with web space, and at the same time cleanup the virtual servers automatically.

Thanks
Sebastian

Topic locked