Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Programming/Scripts

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 4th January 2008, 09:03
webelo webelo is offline
Junior Member
 
Join Date: Jan 2008
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Unhappy shell script, create bulk account

hello there,

was wondering if there is or if its easy to create a shell script that will let me add domains to a server in bulk (like 200 domain), I want to get a list of domain in a .data file, the script should read the file, create the usernames and group for each domain, set a default password, add to virtualhosting apache, create user folder /home/<user>/

Is this possible? Is there anything like this out there?

I don't know, maybe it can run like this...
#!/bin/sh
cat domain.data | \
while read domain
do
echo "Found domain: $domain"
done
---------------

But than have to do the rest

Can anyone help?


Thanks
Reply With Quote
Sponsored Links
  #2  
Old 16th January 2008, 11:59
devnull3d devnull3d is offline
Junior Member
 
Join Date: Jan 2008
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
 
Default

That shouldn't be too hard even in bash but I'd perfer to use perl. I'll attempt to throw something together (untested)
Code:
#!/bin/bash
for domain in `cat domain`
do
 mkdir /home/$domain
 chown apache:apache /home/$domain
 cat apache_vhost_template | sed "s/domain_template/$domain" >> /etc/apache2/sites-enabled/000-default
done
Not exactly what you asked for but it should do the trick, of course you need to create apache_vhost_template yourself, it should look something like this
Code:
$ cat apache_vhost_template
<VirtualHost *:80>
ServerName domain_template
DocumentRoot /home/domain_template
</VirtualHost>
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Chroot SSH + ISPConfig Norman Installation/Configuration 27 26th March 2007 03:40
Verify email setup meekish Installation/Configuration 28 27th October 2006 15:36
need urgent help for writing shell script dips Programming/Scripts 8 3rd September 2006 19:40
Noob Cronjob for shell account ibackup prob Dwalf Installation/Configuration 4 1st August 2006 14:17
How to create FTP account bigger_travis Installation/Configuration 2 28th October 2005 10:03


All times are GMT +2. The time now is 06:57.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.