#!/usr/bin/perl
$IP=”000.000.000.000″; // 이곳엔 사용하고자 하는 아이피를 넣어주세요
$HttpdConfFile = “/etc/httpd/conf/virtualhost.conf”;
$SendmailCW = “/etc/mail/local-host-names”;
$virtual = “/etc/mail/virtusertable”;

print “도메인을 입력해주세요.
“;
print “예) abc.co.kr.

“;
$t1 = <STDIN>;
print “FTP ID를 입력해주세요

“;
$t2 = <STDIN>;
chop $t1;
chop $t2;
if(finger $t2 2>/dev/null){
printf(“이미 존재하는 계정.

“);
exit
}
if($t2 eq “”||$t1 eq “”){
printf(“입력값이 올바르지 않습니다.

“);
exit
}

system(“/usr/sbin/adduser $t2 -d /home/$t1”);
system(“chmod 711 /home/$t1”);
print “Setup Complete!

“;
open (HANDLE,”>>$HttpdConfFile”);
print HANDLE ”
<VirtualHost $IP>
ServerAdmin $t2@$t1
DocumentRoot /home/$t1/public_html
Alias /cgi-bin/ /home/$t1/cgi-bin/
ServerName www.$t1
ServerAlias $t1
TransferLog /log/httpd/$t1-access_log
</VirtualHost>
“;
close (HANDLE);
open (HANDLE,”>>$virtual”);
print HANDLE “webmaster@$t1 $t2
“;
close (HANDLE);
open (HANDLE,”>>$SendmailCW”);
print HANDLE “$t1
“;
close (HANDLE);
system(“cp -f $virtual $virtual.bak”);
system(“/usr/sbin/makemap hash $virtual < $virtual”);
print “FTP 비밀번호를 입력해 주세요.
: “;
system(“passwd $t2”);
system(“service httpd restart”);
print “webmaster Mail Setup Complete!

“;
print “Your E-mail Address : webmaster@$t1